GL_LINEAR bug?

neverever
Unregistered
 
Post: #1
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?
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #2
this happens to me too
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #3
Looks like your texture wrap mode is REPEAT. Try CLAMP or CLAMP_TO_EDGE instead.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #4
arekkusu Wrote:Looks like your texture wrap mode is REPEAT. Try CLAMP or CLAMP_TO_EDGE instead.
how do I do this?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #5
Read the spec.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
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...

Code:
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.
Quote this message in a reply
neverever
Unregistered
 
Post: #7
Ahhh Cool thanks
Quote this message in a reply
Post Reply