nils_pipenbrinck at March 20th, 2006 16:26 — #1
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).
geon at March 20th, 2006 16:33 — #2
I believe you can specify wich color the "edge" should be treated as.
nils_pipenbrinck at March 20th, 2006 16:49 — #3
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)?
reedbeta at March 20th, 2006 20:34 — #4
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.
nils_pipenbrinck at March 21st, 2006 17:20 — #5
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).
hiji at March 17th, 2010 07:19 — #6
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)?
marinity at September 22nd, 2010 14:22 — #7
Thanks, isead about fixing GL_CLAMP to CLAMP_TO_EDGE htlped me