Hi all,
I’m trying to enable blending to make sphere transparent.
But when I enable it, the effect below occurred.
The dividing line appears even if I use lighting. (Currently I just use glColor and disabled lighting.)
Does anyone know the reason? Thanks.
Here are some related code:
One of the spheres which rotating around center:
glColor4f(1.0, 1.0, 0.0, 0.6);
glPushMatrix();
glRotatef(angle, 0, 1, 0);
glTranslatef(0.0, 0.0, 1.0);
glScalef(0.3, 0.01, 0.3);
glEnable(GL_NORMALIZE);
GLUquadricObj *qobjSphere;
qobjSphere = gluNewQuadric();
gluQuadricDrawStyle(qobjSphere, GLU_FILL);
gluQuadricNormals(qobjSphere, GLU_SMOOTH);
gluSphere(qobjSphere, 1, 100, 100);
glPopMatrix();
Enable blending:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);