[font=Helvetica][size=2]Hi All[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]I'm using:[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]If I set alpha = 0 for "edge" pixels - all is as expected (left [/font][font=Helvetica][size=2]picture - no texture outside region). However, with alpha = 255 [/font][font=Helvetica][size=2](middle picture) OpenGL still uses/applies some alpha. I can't [/font][font=Helvetica][size=2]figure out where this alpha comes from? No probs with software [/font][font=Helvetica][size=2]render (right picture)[/font]
[font=Helvetica][size=2]
[/font]
[font=Helvetica][size=2][/font][font=Helvetica][size=2][attachment=2531:OpenGL.png]
[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]What I'm doing wrong?[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]Thanks[/font]
[font=Helvetica][size=2][/font][font=Helvetica][size=2]
[/font][font=Helvetica][size=2]Tom[/font]
GL_CLAMP - what I'm doing wrong?
This could be due to the mip-map level being used. The one pixel alpha border becomes interpolated at lower levels giving an alpha value between the 2 pixels closest to the edge.
(Actually I think this would cause the opposite of your case?)
(Actually I think this would cause the opposite of your case?)
[font="Helvetica"] [/font][font="Helvetica"]If I set alpha = 0 for "edge" pixels[/font]
Define "edge pixels". Does your texture have an actual OpenGL texture border, do you set the constant border colour ?
If the answer to these questions is no or I don't know, then GL_CLAMP isn't doing what you think it is doing. Use GL_CLAMP_TO_EDGE in this case.
Oh, and GL_CLAMP is deprecated anyway.
Thank you, GL_CLAMP_TO_EDGE does solve ny prob!
Define "edge pixels". Does your texture have an actual OpenGL texture border, do you set the constant border colour ?
If the answer to these questions is no or I don't know, then GL_CLAMP isn't doing what you think it is doing. Use GL_CLAMP_TO_EDGE in this case.
Oh, and GL_CLAMP is deprecated anyway.
If I need no texture outside, then I set "edge" pixels of image (alpha = 0) before call glTexImage2D (with "border" param = 0). Maybe there is a better way to do this?
Thanks
Tom
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement