Jump to content
  • Advertisement
Sign in to follow this  
lawnjelly

OpenGL ES max active textures in OpenGL ES 2.0

This topic is 395 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've been making pretty good use of texture atlases in my current game, but as I find myself forced to use another texture (to enable generating tex coords for point sprites), I'm wondering if there may be a better way than currently batching by texture, and calling glBind before each batch.

Instead is it more efficient to pre-bind a whole set of textures to all the available active texture slots, then simply only read from the ones I'm interested in in the fragment shaders (or call glUniform to change the active texture used by the frag shader). Is there any performance penalty to have a load of textures bound, but not being used?

Is this a practical way to work on GLES 2.0, and are there any typical figures for how many active texture slots should be available on mobiles? I'm getting the impression the minimum is 8.

This may make a difference as I'm having to do several render passes on some frames.

Share this post


Link to post
Share on other sites
Advertisement

So, the maximum number of active textures is not the same for every device, you'll need to check it using GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:

https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glActiveTexture.xml

As for binding all those texture, do you really need to bind all of them if your not using all of them? As far as i know this *could* be a hit to performance, the drivers may move the resources to a more accessible location for the shader when they are bound. I don't think this is the right approach.

I think your original method of tiling the textures is a better approach if you want to bind less often.

Another way you can do it is to dynamically create these huge textures. basically each sprite you have can be their own resource, then you copy those resources into the larger texture that you will bind and use for that frame. you can keep them in that texture until you need more space for new sprites to be rendered in the frame, then just overwrite "tiles" in that texture that you are no longer using.

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!