I’m a complete beginner on OpenGL, so bare with me
I got this piece of code down here, and I was supposed to add another object to it, smaller, behind the pyramid:
{******************************}
void RenderScene ()
{
glClear( GL_COLOR_BUFFER_BIT );
pyramid();
glutSwapBuffers();
}
void initFunc ()
{
glClearColor( 1.0f, 1.0f, 1.0f, 0.0f );
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(-2.0,2.0,-2.0,2.0,8.0,12.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glEnable(GL_CULL_FACE);
}
void idleFunc()
{
if ( rotateX ) {
glRotatef( 0.7f, 1.0f, 0.0f, 0.0f );
glutPostRedisplay();
} else if ( rotateY) {
glRotatef( 0.7f, 0.0f, 1.0f, 0.0f );
glutPostRedisplay();
}
}
{******************************}
What I did was modify the renderScene display function this way:
void RenderScene ()
{
glClear( GL_COLOR_BUFFER_BIT );
pyramid();
glPushMatrix;
glScalef(0.75,0.75,0.75);
glTranslatef(0,0,-3);
pyramid();
glPopMatrix;
glutSwapBuffers();
}
However, after the first frame, the screen goes blank I assume it’s a problem with the eye/modelview matrix, but I’m too dumb to figure it ^^"
Oh BTW, the frames are updated by the idleFunc. rotateX/Y are true according to mouse activity (that is the mouse rotates the scene).
Major thanks for any help