Code:
// OpenGL animation code goes here
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClearDepth( -1 );
glClear( GL_COLOR_BUFFER_BIT );
glClear( GL_DEPTH_BUFFER_BIT );
glDepthRange( -5, 5);
glPushMatrix();
glRotatef( theta, 1.0f, 1.0f, 0.0f );
glEnable( GL_CULL_FACE );
glCullFace( GL_FRONT );
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GEQUAL);
glBegin( GL_POLYGON );
glColor3f( 1.0f, 0.0f, 0.0f ); glVertex3f( 0.0f, 1.0f, 0.0f );
glColor3f( 0.0f, 1.0f, 0.0f ); glVertex3f( 0.87f, -0.5f, 0.0f );
glColor3f( 0.0f, 0.0f, 1.0f ); glVertex3f( -0.87f, -0.5f, 0.0f );
glColor3f( 1.0f, 1.0f, 0.0f ); glVertex3f( 0.0f, 0.0f, -1.0f );
glColor3f( 0.0f, 1.0f, 0.0f ); glVertex3f( 0.87f, -0.5f, 0.0f );
glEnd();
glBegin( GL_POLYGON );
glColor3f( 1.0f, 1.0f, 0.0f ); glVertex3f( 0.0f, 0.0f, -1.0f );
glColor3f( 0.0f, 0.0f, 1.0f ); glVertex3f( -0.87f, -0.5f, 0.0f );
glColor3f( 0.0f, 1.0f, 0.0f ); glVertex3f( 0.87f, -0.5f, 0.0f );
glEnd();
glPopMatrix();
glPushMatrix();
glMapGrid1f( 0, 0, 0 );
glDisable( GL_CULL_FACE );
glBegin( GL_POLYGON );
glColor3f( 1.0f, 1.0f, 1.0f ); glVertex3f( 0.0f, 1.0f, -0.1f );
glColor3f( 1.0f, 1.0f, 1.0f ); glVertex3f( 0.87f, -0.5f, -0.1f );
glColor3f( 1.0f, 1.0f, 1.0f ); glVertex3f( -0.87f, -0.5f, -0.1f );
glEnd();
glPopMatrix();
SwapBuffers( hDC );
theta += 1.0f;
Now first this is my first real opengl object, is that the cleanest way to do things? Second, I have tried playing around with glEnable and glLighti but havn't been able to get it to work