PDA

View Full Version : intermittent freezes, glPushAttrib



James W. Walker
04-29-2008, 02:43 PM
On certain machines running Windows, with Nvidia cards, our OpenGL code experienced intermittent freezes. That is, once in a while at irregular intervals, everything (including the mouse cursor) would freeze for maybe 3 to 8 seconds. We couldn't reproduce it on a PC with an ATI card, nor on a Mac with an Nvidia card.

The problematic area of the code looked like this:


glPushAttrib( GL_LINE_BIT );
glLineWidth( myWidth );
DrawSomeLines();
glPopAttrib();

After changing it to the following, the problem went away:


glLineWidth( myWidth );
DrawSomeLines();
glLineWidth( 1.0f );

And if I did this, the problem came back:


glPushAttrib( GL_LINE_BIT );
glPopAttrib();

glLineWidth( myWidth );
DrawSomeLines();
glLineWidth( 1.0f );

Any of this ring any bells?

MichalST
04-29-2008, 11:34 PM
I have expirienced the same probem, the machine was Laptop with nVidia Quadro card. The rendering flow was much more complecated than this one but once i removed push/pop-attrib all begin to works fine - yet i have no idea why it works like this with push/pop sequence.

ZbuffeR
04-30-2008, 12:58 AM
It can be that the driver allocated a block of ram to push/pop attribs, and a small memory leak cause the block to fill.
Then the pause can be caused by the driver allocating a supplementary block ?