problem with drawing a 3d square

hi..I am new to opengl. i am trying to draw a 3d square can someone tell me wats wrong with the code


void myGlutDisplay(void)
{
// glClearColor(1.0,1.0,1.0,1.0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(1,0,0);
glBegin(GL_POLYGONS)
glVertex3f(250,250,1);
glVertex3f(280,250,1);
glVertex3f(280,280,1);
glVertex3f(250,280,1);
glEnd();
glFlush();
glutSwapBuffers();

}

int main(int argc, char **argv)
{

// setup glut
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutInitWindowPosition( 50, 50 );
glutInitWindowSize( WIN_WIDTH, WIN_HEIGHT);



// Initialize my Scene
initScene();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,500,0,500,-1,60);
glMatrixMode(GL_MODELVIEW);


glutMainLoop();
return EXIT_SUCCESS;
}



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories