Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xeee

OpenGL Preserving the value of ONLY ONE OpenGL State ?

This topic is 5532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

when preserving the value of ONLY ONE OpenGL State - GL_BLEND Enable Bit for Example - which is better, use PushAttrib(GL_ENABLE_BIT), Note that it''ll push the value of many other OpenGL States which are not needed. or use a GLint and do it manualy :
// before changing the value of the state

GLint glBlendIsEnabled = glIsEnabled(GL_BLEND);
// some code that''s might change the value of GL_BLEND Enable Bit

...
// after changing the value of the state

if (glBlendIsEnabled)
	glEnable(GL_BLEND);
else
	glDisable(GL_BLEND);
xee..

Share this post


Link to post
Share on other sites
Advertisement
There was a big discussion on this quite a while ago (I can''t find the thread tho). I think it was generally decided that the driver will cache the state if it would be expensive to check it on the card, so doing it yourself:

i) doesn''t hurt unless you do the check twice (i.e. if you''re performing work the driver does)

ii) doesn''t add any performance gain

I''ve never seen any evidence that glIsEnabled slows things down so I''d be interested to see your evidence Austrian Coder.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!