Effect of using glPushAttrib

I have a strange problem in my openGL application.

The application(which is a small program without complex graphics) seemed to use a lot of (graphical) resources. For instances if I where running my application and internet explorer at the same time, Internet explorer would draw any webpages real slow and take minutes to respond to keyboard input.

But if I added the following code in my display loop:

	   glPushAttrib(GL_ALL_ATTRIB_BITS);
	   glPopAttrib();

everything seemed to work fine.

Why can this be? There obviously is something wrong with my code, but what is it???

I would appreciate any help!

add a timer, n00b. you’re hogging your cpu cycles for nothing. learn how to programm in first place

Originally posted by <George>:
add a timer, n00b. you’re hogging your cpu cycles for nothing. learn how to programm in first place
Don’t be so rude! This is a beginners’ forum, you might expect beginners’ questions.

Anyway, what George meant to say, is that your app, altough it is not very complex, still uses up all your CPU time. This is because it takes all the resources it can get and therefore certainly achieves quite a lot of frames per second.

If you artificially slow it down a bit, there will be CPU time left for other applications. The easiest method would be to put a Sleep (10) after your rendering code, this restricts your app to 100 FPS but makes sure your app shares CPU time with other apps.

Jan.