PDA

View Full Version : Texture parameters



enmaniac
12-01-2005, 03:06 AM
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

Bob
12-01-2005, 03:20 AM
glTexParameter sets parameters per texture object, and affects the currently bound texture on the currently active texture unit only.

enmaniac
12-01-2005, 03:33 AM
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 ?

jide
12-01-2005, 08:09 AM
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 (...)
...

enmaniac
12-01-2005, 12:09 PM
Ok. Thank both of you!

This clears me everything :-)