Jump to content
  • Advertisement
Sign in to follow this  
Dario Oliveri

Texture object quick question

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

1 quick question about textures. Texture states like "wrapping mode" and "texture filtering" must be setted each frame when texture is binded or are saved internally, so that when a texture is bind I have to set them once and then when I rebind a texture all previous states was already setted?

Share this post


Link to post
Share on other sites
Advertisement
Those states are properties of the bound texture, i.e. they remain set for that specific texture. If you bind another texture then go back to that one, the states for that texture will still apply.

tl;dr you only need to set them when you create the texture object.

Share this post


Link to post
Share on other sites
Anything set via glTexParameter is part of the texture object (GL defines a texture object as the image itself plus a collection of state) so it only needs to be set once, at creation time. When you bind a texture these parameters are automatically used for it. Anything set via glTexEnv is part of the GL context's state for the currently active texture unit, so it persists until changed no matter what textures are bound.

Share this post


Link to post
Share on other sites
so what If I want the same texture but different settings ( I mean the same texture used with different settings on multiple objects of the same scene)? I have to reload the same texture using more memory or is there a way for bind a texture to multiple texture objects? (because I don't want to call gllTexParameter every frame for each setting that needs to be changed)

Share this post


Link to post
Share on other sites
Calling glTexParameter multiple times shouldn't be a huge performance impact - that's basically the way it's done in D3D (using the broadly equivalent SetSamplerState calls) and it doesn't impact there, so you shouldn't expect it in OpenGL either. Also note that modern OpenGL has sampler objects which work in a similar manner to the D3D way, and that this actually maps closer to how hardware actually works. Look at http://www.opengl.org/registry/specs/ARB/sampler_objects.txt

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!