How to render a texture partly transparent?

Posted by megamoustache on Game Development See other posts from Game Development or by megamoustache
Published on 2011-06-17T06:32:32Z Indexed on 2012/09/19 21:52 UTC
Read the original article Hit count: 184

Filed under:
|
|

Good Morning StackOverflow, I'm having a bit of a problem right now as I can't seem to find a way to render part of a texture transparently with openGL.

Here is my setting : I have a quad, representing a wall, covered with this texture (converted to PNG for uploading purposes). Obviously, I want the wall to be opaque, except for the panes of glass. There is another plane behind the wall which is supposed to show a landscape. I want to see the landscape from behind the window. Each texture is a TGA with alpha channel.

The "landscape" is rendered first, then the wall. I thought it would be sufficient to achieve this effect but apparently it's not the case. The part of the window supposed to be transparent is black and the landscape only appears when I move past the wall.

I tried to fiddle with GLBlendFunc() after having enabled it but it doesn't seem to do the trick.

Am i forgetting an important step ?

Thank you :)

© Game Development or respective owner

Related posts about opengl

Related posts about textures