Advertisement Jump to content
Sign in to follow this  

a beginner ideia of optimization

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

python like pseudocode, my real code is in C++
class WorldClass:
    newobjs = 0
    def render():
        if newobjs > somenumber:
            # sort renderlist using RenderObject.texid
            newobjs = 0
        for obj in renderlist: # everything on that list is RenderObject

class RenderObject:
    def __init__(texture, owner)
        self.texid = # a plain integer
        owner.newojbs += 1

it will work? ps: what is the action of glBindTexture() if i try to bind a texture that is already binded?

Share this post

Link to post
Share on other sites
Yes, sorting by (texture-, material-, shader-, ...)IDs is a quite good way to optimize the rendering process for opaque meshes.

However, for transparent objects you'll need to sort back-to-front.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!