PDA

View Full Version : Transparency Issues



Timlankey
06-26-2010, 05:41 PM
Hi Guys,

I have created this project in OpenGL and I seem to have run into an issue with some objects being able to be seen through the transparency and some cannot.

The coordinates of the images are:

//Railing Wall Left
TEXTURE 18
-0.35 1.5 -2.0 0.0 1.0
-0.35 1.0 -2.0 0.0 0.0
-0.35 1.0 -4.0 3.0 0.0
-0.35 1.5 -4.0 3.0 1.0

//Railing Wall Right
TEXTURE 18
0.35 1.5 -2.0 0.0 1.0
0.35 1.0 -2.0 0.0 0.0
0.35 1.0 -4.0 3.0 0.0
0.35 1.5 -4.0 3.0 1.0

//Railing Back
TEXTURE 18
-0.35 1.5 -2.0 0.0 1.0
-0.35 1.0 -2.0 0.0 0.0
0.35 1.0 -2.0 1.0 0.0
0.35 1.5 -2.0 1.0 1.0

This is just the text file I use to read in the coordinates. Texture is just the id that I'm using and the coordinates go X,Y,Z,U,V.

The U,V are for when I map the image.

Anyways, as you can see in the attached pictures I have created transparency and it works completely for the "Railing Back" size and I can see one other with the "Railing Right" side but the "Railing Left" side completely makes the other 2 railings disappear.

I hope that I have explained this well enough as this is my first post and I am fairly new.

I feel like it has something to do with the way that they are input in the text file and that I must be putting the points some counter clockwise and some clockwise but something else seems odd to me because the Left and Right sides are input exactly the same only one negative and one positive and they are acting differently.

Let me know if you need me to explain this different or any additional information. I'm sure its a simple error of some sort with the coordinates but please bear with me I am rather noob.

Three pics here:
Left Side completely not seeing the back or left side: http://s52.photobucket.com/albums/g27/Timlankey/?action=view&current=6-26-20108-29-38PM.png

Back Side Working how I want it to: http://s52.photobucket.com/albums/g27/Timlankey/?action=view&current=6-26-20108-29-23PM.png

Right Side seeing the right side but not the back side:
http://s52.photobucket.com/albums/g27/Timlankey/?action=view&current=6-26-20108-29-03PM.png

ZbuffeR
06-27-2010, 01:50 AM
Indeed, CW or CCW makes a difference. But in this case, you want to disable backface culling while drawing this, if you want to see the textured quad from both sides.

Then, do you use alpha testing, and/or alpha blending ?
Alpha testings works well with a depth buffer test, alpha blending not so well.

Timlankey
06-27-2010, 09:16 AM
I am using alpha blending that is probably my problem:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Enable Alpha Blending (disable alpha testing)
glEnable(GL_BLEND);

I already have disabled backface culling and I do see the images from both side, only the transparency gives me an issue.

How would I use Alpha testing instead?

Thank you for the reply.

Timlankey
06-27-2010, 09:22 AM
Nvm about my last post, I figured out how to do it....really simple fix.

Thanks once again for the post, I knew it was something simple like that.