Blending and transperancy in OGL
Hi,
i am facing a small problem when applying the transperancy technique.
i have to spheres of radius 10, one in the front at position 0,0,0 and the otehr on the back at 0,0,-40. the front one is set to have the alpha value to 0.5 and the back one to have it as 1.
i am enabling the blending using:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
the blending works fine when i draw the back sphere first then the front one. but when i have the drawing in the reverse order, ie the front then the back, the back sphere disappears?!!! shouldnt it stay there since the front sphere is half transperatn???? note that i have
glEnable(GL_DEPTH_TEST);
any suggestions???
Abolfooud
If you enable GL_DEPTH_TEST, then parts of surfaces behind previously drawn surfaces will not be rendered. To get alpha blending to work properly you'll need to sort the surfaces you render and put them in the pipe back to front. GL won't magically handle it for you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement