View Full Version : glTexParameter affects render/texture state?

07-24-2003, 12:09 PM
When I call glTexParameter() is it changing a state assocatiated with the currently bound texture, or is it changing a state associated with the renderer?

eg. Does each individual texture have a filtering state and edge clamping state that is applied everytime I use that texture, or are these state parameters of the texture units like glTexEnv() is?

The reason I'm asking is that I see lots of examples where glTexParameteri() is called before glTexImage2D() to set the filtering mode like this:

glBindTexture(GL_TEXTURE_2D, cacheTexID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, texData);

but is this necessary? With glTexEnv() I can set the mode to GL_MODULATE before rendering, and this works because the TexEnv mode is a property of the texture units themselves. Can you similarly set the filtering mode just before you render, and not worry what the mode was when you called glTexImage2D() and glBindTexture()? ... of course assuming that you've created the appropiate mipmap levels beforehand if you're using a mipmapped filter setting.

I've tried to find the answer in the red book and in the OpenGL1.4 spec, but maybe I'm not looking in the right spot, or maybe they don't actually say.


07-24-2003, 06:05 PM
TexParameter is per-texture-object state.
TexEnv is per-texture-unit state.