Jump to content
  • Advertisement
Sign in to follow this  

setting filtering: per texture unit or per texture?

This topic is 4534 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

as in, If i set the filtering to, say, nearest. does this stick with the texture objet (whenever I bind that texture, filtering is st to nearest) or with the active texture unit, no matter what texture I load, until I change this? TIA

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Code-R
as in, If i set the filtering to, say, nearest. does this stick with the texture objet (whenever I bind that texture, filtering is st to nearest) or with the active texture unit, no matter what texture I load, until I change this?
TIA
glTexParameter* sets parameters which are per texture object.
glTexEnv* sets environment state which is per texture unit.

So to answer your question, it is per texture object.

Share this post


Link to post
Share on other sites
Hi

glTexParameter* is for all textures unit unless the texture overrides it in the bind definition.
(see http://pyopengl.sourceforge.net/documentation/manual/glTexParameter.3G.html
"When the GL_ARB_multitexture extension is supported, glTexParameter specifies the texture parameters for the active texture unit" )
The state is persistent. If you define it one time for a unit and don't call it again in your app, it will last until the end. So all your textures will be affected by it.
It's better to define it only when you need to to avoid state changes.

Hope it could help

Jeckle
www.kjapi.com

Share this post


Link to post
Share on other sites
Quote:
Original post by jeckleDev
Hi

glTexParameter* is for all textures unit unless the texture overrides it in the bind definition.
(see http://pyopengl.sourceforge.net/documentation/manual/glTexParameter.3G.html
"When the GL_ARB_multitexture extension is supported, glTexParameter specifies the texture parameters for the active texture unit" )
The state is persistent. If you define it one time for a unit and don't call it again in your app, it will last until the end. So all your textures will be affected by it.
It's better to define it only when you need to to avoid state changes.

Hope it could help

Jeckle
www.kjapi.com


No, the previous guys are right. glTexParameter sets the parameter only for the currently bound texture object, not the whole unit. You can test it youself simply by doing something like this:

glBindTexture(GL_TEXTURE_2D,texobj1);
glTexParameter*(...,GL_MAG_FILTER,GL_LINEAR);
glBindTexture(GL_TEXTURE_2D,texobj2);
glTexParameter*(...,GL_MAG_FILTER,GL_NEAREST);

glBindTexture(GL_TEXTURE_2D,texobj1);
RenderObject();//Object is rendered with linear filtering
glBindTexture(GL_TEXTURE_2D,texobj2);
RenderObject();//Object is rendered with NEAREST

You will see that, during rendering, filtering will change depending on whether texobj1 or texobj2 is bound, without having to call TexParameterf each time you want to change it. So no, the parameters are not persistent all over the unit, they are saved for each individual texture object. The quote you mentioned obviously means that, when multitexturing is used and multiple texture objects are bound(one for each unit), glTexParameter changes the parameters of the texture object that is currently binded in the active unit.

Share this post


Link to post
Share on other sites
<CORRECTION>
TexParam is Texture OBJECT property.
TexGen/TexEnv are Texture UNIT properties.
See OpenGL specifications (on www.opengl.org).

[Edited by - Ingenu on December 5, 2005 6:06:57 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Ingenu
All glTex* (Env, Param, Gen) are per TEXTURE OBJECT.
See OpenGL specifications (on www.opengl.org).

No, glTexParameter is per texture object, but glTexEnv and glTexGen is per texture unit. As you said, see the specification.

Share this post


Link to post
Share on other sites
Quote:
Original post by Brother Bob
Quote:
Original post by Ingenu
All glTex* (Env, Param, Gen) are per TEXTURE OBJECT.
See OpenGL specifications (on www.opengl.org).

No, glTexParameter is per texture object, but glTexEnv and glTexGen is per texture unit. As you said, see the specification.


Correct. There's some unnecessary misinformation in this thread, we should at least check the specs or test it ourselves before we post something we're unsure about. There's no reason to confuse beginners who read this thread.
Even the original question could be solved if the OP read the manual or did a little test to see if the params are saved per unit or per texture.

Share this post


Link to post
Share on other sites
Quote:
Original post by Brother Bob
Quote:
Original post by Ingenu
All glTex* (Env, Param, Gen) are per TEXTURE OBJECT.
See OpenGL specifications (on www.opengl.org).

No, glTexParameter is per texture object, but glTexEnv and glTexGen is per texture unit. As you said, see the specification.


You're RIGHT !
I can't believe I missed that in the specs, although I now know exactly why I did this mistake :(

For the Record I did quick check what I was saying, I read the attribute linked to Param, Gen & Env which are all "texture" and concluded wrongly that they were per texture object...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!