Jump to content
  • Advertisement
Sign in to follow this  
Marvin

OpenGL OpenGL state changes and drivers

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

Hi, this is just something that popped into my head.. In my engine i have materials defined that require different OpenGL states. If for example i had two objects that needed lighting on, which would mean two calls to glEnable(GL_LIGHTING) when those objects had their render method called. Would the OpenGL driver know that lighting was already enabled and ignore the second glEnable call with no performance hit, or should i be keeping track of the OpenGL state myself in my application and not making uneeded state changes. I already plan to sort all objects by shader, then sort by texture and then call the render methods of each object in an attept to avoid too many state changes. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
The long and the short of its is, maybe.

In all honesty, its probably better to manage the lights yourself in an abstract, way, so when you want to activate a light you'll call your own light manager and let it determin if the light is on or off, enabling it if needs be. This saves a call into the driver and if the light is going to be on often should save you a tiny bit of work.

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!