PDA

View Full Version : compiles,but does not draw curve



marysowdha
11-13-2001, 12:35 PM
Hi can somebody please look into my code, It does not draw the curve???

#include<gl\glut.h>
GLfloat controlpoints[4][3]= {{-1.0,1.0,0.0},{0.0,0.0,0.0},{1.0,1.0,0.0},{2.0,4.0, 0.0}};
void display()
{
inti ; glClear(GL_COLOR_BUFFER_BIT);
int plotpoint = 100;
glMap1f(GL_MAP1_VERTEX_3,0.0,1.0,3,4,&controlpoints[0][0]);
glBegin(GL_LINE_STRIP);
for (i = 0;i<=plotpoint;i++)
glEvalCoord1f((1.0*i)/plotpoint);
glEnd();
}
void init()
{
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(0.0,0.0,0.0);
glEnable(GL_MAP1_VERTEX_3);

}
void reshape(int w,int h)

{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-4.5,4.5,-4.5,4.5,-4.5,4.5);
glMatrixMode(GL_MODELVIEW);

}


void main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("homework9-1");
glutDisplayFunc(display);
init();
glutReshapeFunc(reshape);

glutMainLoop();
}

Bob
11-14-2001, 12:34 AM
The only thing I'm missing is a call to glutInitDisplayMode in the main function, and maybe a glutSwapBuffers in the display function.

marysowdha
11-14-2001, 09:21 AM
Hi,

It works now,Thanks a lot
Mary