Jump to content
  • Advertisement
Sign in to follow this  
viever

OpenGL Best way to sort objects of a scene ?

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

Hello,

I am creating an OpenGL Renderer class, and I am trying to figure a way to optimize things.

 

In my scene, there are objects sharing same mesh, objects sharing same shader, objects sharing both and objects sharing textures etc ...

 

For objects sharing mesh and shader I could use instanced rendering.

 

But what about the other objects, how do I sort them ? I sort them by buffer, by shader or by texture ?

 

thanks

Edited by viever

Share this post


Link to post
Share on other sites
Advertisement

Depends...

I am sorting my objects shader 1st then mesh then pipeline state changes (like enable depth/cull/blend and stuff).

In general the benefit from sorting is minimizing api overhead, since most of the objects share the same shader, I figured to sort the objects according to their shader first. geometry changes more often than the pipeline state and so on...

I do not have any proof that this is the best way to do it, but this is the way I am doing it and it works pretty nicley.

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!