PDA

View Full Version : transparency problems



incredible_hulk
08-22-2001, 02:51 AM
Hi everyone,

I've designed a GUI using openGL which involves positioning a small sphere on the surface of a large sphere using mouse input. I've written the code so that a left mouse click will position the object on the 'near' side of the sphere - no problem there. And with a right mouse click it will position it on the 'far' side of the sphere - i.e. behind the sphere. But I still want to be able to see the small sphere when its behind, so I thought to use some transparency. I've used glColor4f to give the large sphere an alpha value of 0.5, while the small sphere has an alpha value of 1.0. But when I move the small behind the large, it still disappears! As far as I know I've activated all the necessary blend function, depth buffer, depth testing, etc. Can anyone think where I might be going wrong??? Or do I need to give more information?

Thanks,
James

ffish
08-22-2001, 04:09 AM
You have to draw your objects back to front (furthest away first), or maybe draw the large sphere, disable depth testing and draw the small sphere behind. The reason it isn't showing up is because the depth test says the small sphere is behind the large one so shouldn't be drawn.

Hope that helps.