PDA

View Full Version : GL_LINEAR bug?


neverever
2004.11.06, 08:55 PM
Ok, I have this 128x128 texture. When I choose the GL_LINEAR filter, the texture gets this pixel line at the top, which is identical to the pixel line at the bottom, except thinner.

When I choose GL_NEAREST, there isn't any line at all.

http://www.reversecode.com/dl/idevgamez/lava.zip

There are the two builds, one with GL_LINEAR and the other with GL_NEAREST. Why does GL_LINEAR add that 1/2 pixel(image scale) to the top of the image?

skyhawk
2004.11.06, 09:50 PM
this happens to me too

arekkusu
2004.11.06, 10:02 PM
Looks like your texture wrap mode is REPEAT. Try CLAMP or CLAMP_TO_EDGE instead.

skyhawk
2004.11.06, 10:21 PM
Looks like your texture wrap mode is REPEAT. Try CLAMP or CLAMP_TO_EDGE instead.
how do I do this?

arekkusu
2004.11.06, 10:30 PM
Read the spec.

OneSadCookie
2004.11.06, 11:13 PM
you want CLAMP_TO_EDGE(_SGIS). CLAMP doesn't seem to be useful for anything.

I agree with arekkusu -- read the online red book, or search google or something, but...

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE_SGIS);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE_SGIS);

This is per-texture state, so you must do it once for each texture, with that texture bound.

neverever
2004.11.07, 12:33 PM
Ahhh :cool: thanks