Scope of glTexParameter, glTexEnv, glPixelStore.

Do things I change with glTexParameter only apply to the currently bound texture? Do they stay associated with that texture even if I bind to a different texture? For example, if I do (texa and texb are valid texture names):

glBindTexture(GL_TEXTURE_2D, texa);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glBindTexture(GL_TEXTURE_2D, texb);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

Is ‘texa’ always going to use linear filtering and ‘texb’ always going to use GL_NEAREST from now on? Or do I need to reset glTexParameter every time I call glBindTexture?

What about glTexEnv and glPixelStore? I’m assuming that those are completely independent of whatever texture is currently selected, right (because glTexEnv doesn’t take a texture target, and glPixelStore applies to more than just texture data transfers)?

Thanks!
Jason

Parameters set with glTexParameter affects the currently bound texture object, and stays with the texture object until changed. That means, in your code, texa will always use linear filtering and texb will always use nearest filtering, no matter how you bind and unbind other texture objects.

Parameters set with glTexEnv affects the currently active texture unit, and stays with the texture unit until changed. That means, if you set the texture unit to GL_MODULATE (multiply texture and primary color), GL_MODULATE is used no matter what textures are bound to it.

Parameters set with glPixelStore defines how pixel addresses on the client side are generated when transferring between client and server in any direction. That means, it affects for example how glTexImage (client to server), glDrawPixels (client to server) and glReadPixels (server to client) should read/store the image data in client memory. It does not affect server to server transfers like glCopyPixels. You can use it, for example, to create a texture from a subimage of a larger image in memory.

Thanks for explaining that, Bob, that answers all my questions. Sorry, I had to put the project I was working on on the back burner for a while and forgot about this thread for a while.

Jason