views:

56

answers:

1

Hey guys I just had a simple question. Does glTexParamter act on all textures or just the texture that is currently bound

So like if I call this at the texture load:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

And this on another texture load:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

When I bind the first texture will it just use the last value I set (GL_CLAMP) or will it use the values set while the texture was bound?

+2  A: 

From the OpenGL FAQ:


21.070 How do texture objects work?

Texture objects store texture maps and their associated texture parameter state. They allow switching between textures with a single call to glBindTexture().

(...)

The following functions affect and store state in texture objects: glTexImage*(), glTexSubImage*(), glCopyTexImage*(), glCopyTexSubImage*(), glTexParameter*(), and glPrioritizeTextures(). Since the GLU routines for building mipmap pyramids ultimately call glTexImage*(), they also affect texture object state.Noticeably absent from this list are glTexEnv*() and glTexGen*(); they do not store state in texture objects.


Ergo, glTexParameter* affects only the bound texture.

Kornel Kisielewicz
Very cool that is what I was hoping otherwise I would have to do a bunch of state changes everytime I bound a texture.
Justin Meiners