openGL screwy edges of textures
Quite often I'm seeing weird white lines on the edges of textures.
I'm working on a 2d game and am using openGL. A workaround that I've found that works is to make the texture coordinate 0.999 instead of 1.0. But this is messy.
I'm pretty sure that there are no white lines on the tga files themselves.
Usually the lines take up only a small amount of the edge of the texture - only half or less.
I am using the NeHe tga texture loading code, if that helps.
any ideas?
I'm working on a 2d game and am using openGL. A workaround that I've found that works is to make the texture coordinate 0.999 instead of 1.0. But this is messy.
I'm pretty sure that there are no white lines on the tga files themselves.
Usually the lines take up only a small amount of the edge of the texture - only half or less.
I am using the NeHe tga texture loading code, if that helps.
any ideas?
Make sure you're not making a texture with a border.
Make sure your TEXTURE_WRAP_S and TEXTURE_WRAP_T are set to either GL_REPEAT or GL_CLAMP_TO_EDGE_SGIS.
Make sure your TEXTURE_WRAP_S and TEXTURE_WRAP_T are set to either GL_REPEAT or GL_CLAMP_TO_EDGE_SGIS.
You may be talking about a similar problem that I was having. If you are displaying only parts of a larger texture on a poly, you may be getting "spill over" from the neighboring "texels." 
I used a similar solution to yours, but it's only a temporary fix.
arekkusu boiled it down and filed a bug report with Apple. Check out the details at this site. Apparently, it will be fixed soon.
If you have time to read the extensive discussion, you can check it out on this thread.
On the other hand, your problem may be more simple as suggested above.

I used a similar solution to yours, but it's only a temporary fix.
arekkusu boiled it down and filed a bug report with Apple. Check out the details at this site. Apparently, it will be fixed soon.
If you have time to read the extensive discussion, you can check it out on this thread.
On the other hand, your problem may be more simple as suggested above.
"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote:Originally posted by aaronsullivan
You [b]may be talking about a similar problem that I was having.
...
arekkusu boiled it down and filed a bug report with Apple. [/b]
No, my bug is about gluOrtho2D producing slightly inexact projection coordinates.
This problem is about texturing coordinates and is completely unrelated.
As OSC says, it is likely due to the texture border mode.
Indeed, if you are talking about displaying the entire texture and/or you have no white anywhere in the texture you are using, it has NOTHING to do with my earlier post or the bug.
"Pay no attention to that man behind the curtain." - Wizard of Oz
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
Thanks again, the above code did the trick when placed in the loading part of the code. Funny, I really have no idea what I'm doing and I keep expecting to run into a dead end or something. So far my game's working alright though and I guess thats the main thing. I'll just keep waiting for things to break before I fix them. (with a bit of help from you guys) cheers
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
Thanks again, the above code did the trick when placed in the loading part of the code. Funny, I really have no idea what I'm doing and I keep expecting to run into a dead end or something. So far my game's working alright though and I guess thats the main thing. I'll just keep waiting for things to break before I fix them. (with a bit of help from you guys) cheers
You (almost) never want GL_CLAMP. GL_CLAMP_TO_EDGE_SGIS is almost always the right mode to use.
What's the difference between GL_CLAMP_TO_EDGE_SGIS and plain GL_CLAMP_TO_EDGE from GL 1.2?
Nothing AFAIK, but Rage 128s, GeForce2MXs and GeForce4MXs don't support OpenGL 1.2, so technically if you're supporting those cards you should check for the extension and use the extension's constant.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Create Aquaria-like terrain- texturing edges | AndyKorth | 3 | 5,344 |
Jul 31, 2011 08:13 PM Last Post: FlamingHairball |
|
| [SOLVED]OpenGL edges of textures | mk12 | 2 | 3,613 |
Sep 2, 2010 08:07 PM Last Post: mk12 |
|
| Replacing edges with degenerate quads (for shadow volumes) | Coyote | 9 | 6,394 |
Jan 15, 2010 07:08 PM Last Post: Coyote |
|
| OpenGL Image Textures | mikey | 52 | 19,915 |
Jun 30, 2009 10:42 AM Last Post: AnotherJake |
|
| Dealing with inverted textures in OpenGL | johncmurphy | 7 | 5,844 |
Jun 15, 2009 08:11 AM Last Post: Skorche |
|

