Does someone knows the exact difference between those two?
I had some problems using GL_CLAMP today. When I use it and the UV-coordinates go out of the 0..1 range something black gets blended into my texels (all my texels that are out of the 0.1 range are exactly halfed in value. on the extreme edges (where u and v are out of range) I have 1/4 of my color.
GL_CLAMP_TO_EDGE get's rid of that effect and clamps as I would expect it (or better said - as I know clamping from d3d)
I wonder: The spec sais: GL_CLAMP clamps the texture coordinates to 0 and 1. That would be perfectly fine for me, but somehow black blends into the pixels (even if my texture is entirely white).
I believe you can specify wich color the "edge" should be treated as.
Ok, so I can somehow specify the "outside of the texture" color, and OpenGL blends towards that color up to 0.5f.
And CLAMP_TO_EDGE just clamps to the edge-texels and ignores the outside-color (as I would expect clamping to work in the first place)?
Correct. The border colors can be set when you specify the texture image with glTexImage2D, though I've never used this feature and can't think of a situation where it would be useful...GL_CLAMP_TO_EDGE clamps to [0 + 0.5*texel, 1 - 0.5*texel]. Since the texel centers are considered to be at 0.5's in OpenGL, clamping to [0, 1] causes bilinear filtering between the edge pixels and the border colors to kick in.
Thanks a lot. that makes sense. I now changed all my references to GL_CLAMP to CLAMP_TO_EDGE. That's all I have on OpenGL/ES anyways (my target api).
Thank you so much for clarifying this, GL_CLAMP to CLAMP_TO_EDGE also solved my issue. I was stuck on it from last couple of days but just got it and its working fine now.
Ok, so I can somehow specify the "outside of the texture" color, and OpenGL blends towards that color up to 0.5f. And CLAMP_TO_EDGE just clamps to the edge-texels and ignores the outside-color (as I would expect clamping to work in the first place)?
Thanks, isead about fixing GL_CLAMP to CLAMP_TO_EDGE htlped me