I tried the cast as you suggested, still spits out 3 errors. I wrote the errors in the previous code. I'll rewrite them here to make them clearer and more obvious. Thanks again.
#include <windows.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <iostream.h>
#include <time.h>
class BezierClass {
public:
float x1,y1;
float x2,y2;
float x_cp1,y_cp1;
float x_cp2,y_cp2;
float x_cp3,y_cp3;
float x_cp4,y_cp4;
float xpos,ypos;
float bezierArray[6][3];
BezierClass() {
float x1,y1;
float x2,y2;
float x_cp1,y_cp1;
float x_cp2,y_cp2;
float x_cp3,y_cp3;
float x_cp4,y_cp4;
float xpos,ypos;
bezierArray[6][3]={ {x1, y1, 0.0}, ********error here:Expression syntax error****
{x_cp1, y_cp1, 0.0}, /* 1st Control P. */
{x_cp2, y_cp2, 0.0}, /* 2nd Control P. */
{x_cp3, y_cp3, 0.0}, /* 3rd Control P. */
{x_cp4, y_cp4, 0.0}, /* 3th Control P. */
{x2, y2, 0.0} }; /* 2nd End Point */
}
};
/* Create an array of type bezierClass that may hold 100 beziers */
BezierClass bezier[100];
int beziernum=0;
int totalbezier=5;
float zoom = -7;
void InitGL(int Width, int Height)
{
glClearDepth(1.0);
glClearColor(0.0, 0.0, 0.0, 0.0); /* bg color = black */
glDepthFunc(GL_LESS); /* nearer appears nearer */
glEnable(GL_DEPTH_TEST); /* enable depth testing */
glShadeModel(GL_SMOOTH); /* shade colors smooth */
glMatrixMode(GL_PROJECTION
glLoadIdentity(); /* reset the cur. matrix */
gluPerspective(45.0f,(GLfl
glMatrixMode(GL_MODELVIEW)
}
void DrawGLScene(void)
{
int i; /* temp var */
/* Clear the screen and the buffers */
glClear(GL_COLOR_BUFFER_BI
glLoadIdentity(); /* reset cur. matrix */
glTranslatef(0.0f, 0.0f, -10.0f); /* move the cam */
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 6, (GLfloat*) bezier[0].bezierArray[1][0
(Error: Illegal explicit conversion from 'float' to 'float*')
glEnable(GL_MAP1_VERTEX_3)
glColor3f(1.0, 1.0, 1.0); /* set color to white */
glBegin(GL_LINE_STRIP); /* start drawing */
for(i = 0; i <= 60; i++)
{
glEvalCoord1f((float)i/60.
}
glEnd(); /* stop drawing */
glPointSize(3.0); /* set point size to 3px */
glColor3f(1.0f, 1.0f, 0.0f); /* set color to yellow */
glBegin(GL_POINTS); /* start drawing again */
for(i = 0; i < 6; i++)
{
/* draw all control/end points */
glVertex3fv((GLfloat*)bezi
(Error: Illegal explicit conversion from 'float' to 'float*')
}
glEnd();
glFlush(); /* Flush all buffers */
glutSwapBuffers(); /* Sawp buffers */
return;
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLint) w, (GLint) h);
glMatrixMode(GL_PROJECTION
glLoadIdentity();
if ( h==0)
gluPerspective(45, (GLdouble)w, 1.0, 100.0);
else
gluPerspective(45, (GLdouble)w/(GLdouble)h,1.
glMatrixMode(GL_MODELVIEW)
glLoadIdentity();
}
void idle_func (void)
{
for (beziernum=0 ;beziernum < 100; beziernum++) {
//bezierArray[beziernum].y
}
glutPostRedisplay();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_R
glutInitWindowSize (800, 600);
glutCreateWindow (argv[0]);
glutReshapeFunc (reshape);
glutDisplayFunc (DrawGLScene);
glutIdleFunc (idle_func);
glutMainLoop();
return 0;
}
Main Topics
Browse All Topics





by: sunnycoderPosted on 2003-11-26 at 21:33:39ID: 9829715
>glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 6, &bezierArray[0][0]);
from the man page::::
points is the location of the first control point, which occupies one, two, three, or four contiguous memory locations, depending on which map is being defined.
so you really should be passing &bezierArray[1][0] ... but anyway, it should not have complained as the data types look right ...
try casting to GLfloat *
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 6, (GLfloat *)&bezierArray[0][0]);
If that does not work, tell us the following:
what is the platform? ... also what is the exact error message (along with the error number)