PDA

View Full Version : gluSphere, glDrawArrays and Blending



reztirps
02-03-2009, 11:44 AM
Hi,

I have a scene with several textured quads drawn using glDrawArrays, a sphere drawn with gluSphere that should be transparent, another small sphere that is always located at the camera's target position and a grid that consists simply of lines drawn using glBegin / glEnd.

Blending works perfectly amongst the quads (the texture has an alpha channel), but with the transparent sphere it behaves in a very strange way: it works only for objects not drawn with the glDrawArrays. I can see the grid and the target sphere perfectly through the transparent sphere, but the quads that are drawn with glDrawArrays that are either inside the sphere or behind it do not appear at all.

The transparent sphere is the first thing drawn and I've already tried disabling the depth test before drawing it and re-enabling right afterwards, and also playing with disabling and enabling culling and the depth mask. Nothing seemed to work, though. Anyone knows what might be going on?

I'm setting up the OpenGL scene with:

glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_COLOR_MATERIAL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER, 0.1);
glEnable(GL_ALPHA_TEST);

Thanks in advance!