PDA

View Full Version : glutRepostDisplay()



McBain
11-12-2001, 02:56 PM
when i return from fullscreen game mode my app crashes (tested of different platform with latest drivers)
when i disable my glutIdle function or when i comment the glutPostRedisplay in that function, the app doesn't crash ...

any1?

11-12-2001, 05:01 PM
can you post your display code? If not, check to see if you are using glPushMatrix or glPopMatrix and popping an empty stack or something.

McBain
11-13-2001, 06:08 AM
Originally posted by mr x:
can you post your display code? If not, check to see if you are using glPushMatrix or glPopMatrix and popping an empty stack or something.

display code:

// gl scene display function
void GLApplication::glDisplayFunc(void) {
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
/* move our eye position 50 units away */
glTranslatef (0, 0, -50);
/* apply the rotation from the mouse */
glRotatef (_mouseRotX, 1.0, 0.0, 0.0);
glRotatef (_mouseRotY, 0.0, 1.0, 0.0);
glBegin (GL_LINES);
glColor3f (0.5, 0.0, 0.0);
glVertex3f (-20.0, 0.0, 0.0);
glVertex3f (20.0, 0.0, 0.0);

glColor3f (0.0, 0.5, 0.0);
glVertex3f (0.0, 20.0, 0.0);
glVertex3f (0.0, -20.0, 0.0);

glColor3f (0.0, 0.0, 0.5);
glVertex3f (0.0, 0.0, -20.0);
glVertex3f (0.0, 0.0, 20.0);

glEnd ();

glutSwapBuffers();
}

animation code:

// gl animation function
void GLApplication::glAnimationFunc(void) {
if (_doesAnimation) {
_animationRotate += 2.0f;
if (_animationRotate > 360) {
_animationRotate = 0.0f;
}
glutPostRedisplay();
}
}

McBain
11-13-2001, 06:16 AM
a bit more relevant code is on
http://users.pandora.be/lagae/code.html