glPushAttrib() glPopAttrib() ?

Funny thing, my rendered image is not visible, screen is black, when I render a polygon image without glPushAttrib() glPopAttrib(), and visible if I include them, but I can’t see why this would be.

Here is a facsimile of my rendering pipeline

render()
{
clearscreen();
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPopAttrib();
drawObject();
glFlush();
}

I have nothing sandwiched between the glPushAttrib(…) and glPopAttrib(), yet when it’s there the scene is fully visible, otherwise it is pitch black.

Okay, what do I make of this?

[This message has been edited by Archimedes (edited 09-20-2002).]

I would consider the possibility that something else is causing the problem first. Check for errors with glGetError before calling that function.

Your post is incomplete:
double buffer or single?
Card + driver, OS?
why the glFlush command?
projection and modelview matrix?

V-man

Thanks for the feedback, V-man.

I’ve researched the problem a bit more, and it may be a Windows issue. I’ve noticed that if I pop down the menu, then go back to the main view screen the image reappears.

I’ll answer your specifics just to be more complete, and I don’t expect any help here, just thought someone might have a quick answer:

I checked for errors and none are returned.

I have GeForce4 on WinXP, double buffering. The Projection Matrix is:

ProjectionMatrix:
1.42106,0,0,0
0,2.41421,0,0
0,0,-1.0002,-0.20002
0,0,-1,0

The ModelView Matrix changes continuously as the scene moves, starting with the identity matrix:

ModelViewMatrix:
1,0,0,0
0,1,0,0
0,0,1,0
0,0,0,1

later it’s this:
ModelViewMatrix:
1,-4.86716e-008,-1.69896e-010,0
-4.86719e-008,-0.999994,-0.00349063,0.6
-1.18447e-015,0.00349063,-0.999994,-28.79
0,0,0,1

I’m using glFlush() because I get the impression from page 34 of the Red Book that it’s good practice to use it.

Remember, everything works fine when the glPushAttrib(), glPopAttrib() are there. But, also, now just popping down a menu selection and going back to the view screen causes the image to reappear. I am using an MFC framework, so I’ll look into this.

Thanks much.