texture mapping issue

Started by
4 comments, last by Geometrian 14 years, 1 month ago
Hi folks, I'm having some trouble tracking down a texturing issue. It's been a while since I've worked with OpenGL so forgive me if this has an obvious fix. This image demonstrates my issue: As you can see, the edges of quads are seems to be grabbing texels from the opposite edge of the texture. Initially I assumed my texture coords were somehow wrong, but after extensive checking I'm pretty sure they are correct. I tried using glTexParameter() with GL_CLAMP, various filtering options, and different textures with the same result. Also glGetError() shows no errors at any point. I'm about to start banging my head on the keyboard so any help would be appreciated
Advertisement
Use GL_CLAMP_TO_EDGE. GL_CLAMP does not in fact do what it says on the box...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I tried that also, same result.

Also tried using using GLuints instead of GLfloat for the texture coords, just to be sure.
Ok, so as it turns out GL_CLAMP_TO_EDGE works but I was using it incorrectly.

That leads me to another question however. If I wanted to double the length of the cube without texture stretching, I'd need to render additional quads?
Quote:Original post by Heretus
That leads me to another question however. If I wanted to double the length of the cube without texture stretching, I'd need to render additional quads?
Pretty much, yes. You can however do some tricks with texture borders, but I am not sure how well this meshes with modern hardware.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote:If I wanted to double the length of the cube without texture stretching, I'd need to render additional quads?
You can always do things like "glTexCoord2f(2.0,2.0)" to tile the texture twice over a cube with sides twice as long. Note that you can't use clamp in that case, though.

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement