views:

30

answers:

1

I use glBindTexture() to bind a previously created texture. After the glBindTexture() call I use glTexParameteri() to set MIN and MAG filter. No problem so far.

Are those parameters I set using glTexParameteri() bound to the texture itself or are they lost if I bind another texture. Do i have to set them again?

glGenTexture(1, &tex1);
glGenTexture(1, &tex2);

/* bind tex1 and set params */
glBindtexture(GL_TEXTURE_RECTANGLE_ARB, tex1);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, ...);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

/* do something */

/* bind tex2 and set params */
glBindtexture(GL_TEXTURE_RECTANGLE_ARB, tex2);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, ...);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

/* do something */

/* bind tex1 again */
glBindtexture(GL_TEXTURE_RECTANGLE_ARB, tex1);

/* do i have to set the parameters from above again or are they stored with tex1? */
+4  A: 

They're kept. The manual page for glBindTexture() says:

While a texture is bound, GL operations on the target to which it is bound affect the bound texture.

Since the first parameter of glTexParameter() is a target, they apply to the bound object just like glTexImage().

unwind
thanks for clarifying this :)
fen