Jump to content

  • Log In with Google      Sign In   
  • Create Account

Odd texture filtering issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Blips   Members   -  Reputation: 122

Like
0Likes
Like

Posted 24 September 2011 - 01:00 PM

I'm approaching completion on my first OpenGL ES game (yay!) but just recently ran into an odd issue with texture filtering. I was trying to improve the game's performance when linear filtering suddenly broke. Code when creating textures was this:

glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);  
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);

But now, I'm having to set the texture parameters when binding textures and rendering geometry. Is this normal and was it just a fluke that it was working before?

Sponsor:

#2 dpadam450   Members   -  Reputation: 948

Like
0Likes
Like

Posted 24 September 2011 - 05:51 PM

You only need to set it once for each texture.

#3 Blips   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 September 2011 - 12:40 AM

You only need to set it once for each texture.


So why is it not working unless I re-set it during rendering?

#4 L. Spiro   Crossbones+   -  Reputation: 14272

Like
0Likes
Like

Posted 25 September 2011 - 01:49 AM

Unbind the texture after you are done creating it to make sure you are not accidentally changing its properties later.

glBindTexture( GL_TEXTURE_2D, 0 );


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#5 Blips   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 September 2011 - 12:20 PM

Unbind the texture after you are done creating it to make sure you are not accidentally changing its properties later.

glBindTexture( GL_TEXTURE_2D, 0 );

L. Spiro


Sorry, I forgot to include that line. I already was / am doing that.

#6 L. Spiro   Crossbones+   -  Reputation: 14272

Like
0Likes
Like

Posted 25 September 2011 - 07:26 PM

Search your project for GL_TEXTURE_MIN_FILTER and check every location where you are calling that.

After you have set the GL_TEXTURE_MIN_FILTER property on your texture, you do not need to change it. Therefore you need to focus your search on where you are re-binding that texture (unintentionally) and changing its GL_TEXTURE_MIN_FILTER.
Check every location where you use GL_TEXTURE_MIN_FILTER, and be sure of exactly which texture is bound. It may not be the one you think.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS