Jump to content
  • Advertisement
Sign in to follow this  
Guy Perfect

Switching Texture Filtering Modes

This topic is 4614 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

Out of curiosity, is there any easy way to force textures that are loaded with "glTexParameteri GL_TEXTURE_2D, [whatever], GL_LINEAR" to be drawn without linear filtering? That'd be convenient, since the project I'm working on loads a good number of textures and I'd like an option for the user to test performace with and without linear filtering on the fly without reloading all those textures. So is there any switch I can throw to "disable linear filtering"?

Share this post


Link to post
Share on other sites
Advertisement
No, but while binding the texture you can change the filtering mode to GL_LINEAR, GL_NEAREST, GL_CLAMP_TO_EDGE - etc

As in something like the following should work


if(i == 1)
{
glTexParamteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParamteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
....
}
else if (i == 2)
{
glTexParamteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParamteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}

glBindTexture(...);
Draw();






Share this post


Link to post
Share on other sites
Alright. The program loads a good number of textures (some 400 of them) and I just wanted to know if I could switch between linear and nearest on the fly without reloading the textures, since that can take upwards of three seconds on some computers.

Thanks for the heads-up.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!