Original Post
Hello guys,
I am just getting into OpenGL and am having some problems. I get access violation errors and my computer freezes when I try to draw a cube on the screen.
At the moment I just want to display the cube without rotating it. The following is my Update() function that is being executed in the message loop of my program.
If anyone knows what I did wrong please let me know.
-------------------------------
Did someone say "banana"?
..-=gLaDiAtOr=-..
BOOL MAIN_Update( void )
{
if ( keys[ VK_ESCAPE ] )
return FALSE;
glClear( GL_COLOR_BUFFER_BIT );
glLoadIdentity();
glBegin( GL_QUADS );
// face 1 (front)
glColor3f( 1, 0, 0 );
glVertex3f( 1, 1, 1 );
glVertex3f( 1, -1, 1 );
glVertex3f( -1, -1, 1 );
glVertex3f( -1, 1, 1 );
// face 2 (left)
glColor3f( 0, 1, 0 );
glVertex3f( -1, 1, 1 );
glVertex3f( -1, -1, 1 );
glVertex3f( -1, -1, -1 );
glVertex3f( -1, 1, -1 );
// face 3 (back)
glColor3f( 0, 0, 1 );
glVertex3f( 1, 1, -1 );
glVertex3f( 1, -1, -1 );
glVertex3f( -1, -1, -1 );
glVertex3f( -1, 1, -1 );
// face 4 (right)
glColor3f( 1, 0, 0 );
glVertex3f( 1, 1, 1 );
glVertex3f( 1, -1, 1 );
glVertex3f( 1, -1, -1 );
glVertex3f( 1, 1, -1 );
// face 5 (top)
glColor3f( 1, 1, 0 );
glVertex3f( 1, 1, 1 );
glVertex3f( -1, 1, 1 );
glVertex3f( -1, 1, -1 );
glVertex3f( 1, 1, -1 );
// face 6 (bottom)
glColor3f( 0, 1, 1 );
glVertex3f( 1, -1, 1 );
glVertex3f( -1, -1, 1 );
glVertex3f( -1, -1, -1 );
glVertex3f( 1, -1, -1 );
glEnd();
SwapBuffers( hDC );
return TRUE;
}
|
..-=gLaDiAtOr=-..