Jump to content
  • Advertisement
Sign in to follow this  
coordz

[mainly C++/openGL] save/restore state or destroy state?

This topic is 4015 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

I'm trying to decide whether to have my functions religiously save and restore the [OpenGL] state or to let the function destroy the current state. What is the general wisdom on this? On the one hand, by saving and restoring the current state means I can just call a function from wherever I feel and not have to worry about the consequences. On the other hand, there's extra overhead and redundancies that could be avoided by letting the current state be destroyed. This choice doesn't only occur with OpenGL but with other things as well, such as assembler functions and the like.

Share this post


Link to post
Share on other sites
Advertisement
Nothing at all. I can carefully save and restore states no problem. I'm asking whether it is worth doing or not.

Share this post


Link to post
Share on other sites
Quote:
Original post by coordz
Nothing at all. I can carefully save and restore states no problem. I'm asking whether it is worth doing or not.


Depends on whether or not the calling function expects to be in the same state after the called function returns.

Grouping calls to functions that expect the same state is a good idea.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!