Texture parameters

Hi,

I have the following question:

Does the glTexParameteri function changes the parameter for currently enabled texture only ? For instance:

// bind texture 1
glBindTexture( GL_TEXTURE_2D, 1 );

// Set texture parameters		
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );  

// bind texture 2
glBindTexture( GL_TEXTURE_2D, 1 );

// do above parameters affect this newly binded texture too ? Or should I specify the parameters again ?

If anyone could explain me how does it work or give some link where it is described it would be great.

Thx in advance

glTexParameter sets parameters per texture object, and affects the currently bound texture on the currently active texture unit only.

So, as far as I understand I can just bind the texture and change its params on-the-fly and new parameters will be taken into account while rendering all textured objects after params change. I am I right ?

The function affects only the last bound texture (or said currently bound texture). If you want it to affect all textures, you must call it for each texture (so binding one texture, then calling glTexParameter and do that for each texture).

ie:

BindTexture (tex1)
TexParameter (...)
TexParameter (...)
BindTexture (tex2)
TexParameter (...)
TexParameter (...)
...

Ok. Thank both of you!

This clears me everything :slight_smile: