PDA

View Full Version : Problem with transparency - glBlendFunc()



lordmonkey
12-23-2010, 11:36 AM
Hello,
I am trying to draw transparent sphere and something inside it (obj model) but I cannot render it properly. I know that I should first render inside opaque objects and then transparent sphere but how ?
I have something like this already but not working properly.

DrawOBJ(head->m_iMeshID);
renderSphere_convenient(0, 0, 0, 15, 10);
any ideas how to do it properly ? I think the problem is with my glBlendFunc() I don't know which parameters to use :p


void renderSphere_convenient(float x, float y, float z, float radius, int subdivisions)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GLUquadricObj *quadric = gluNewQuadric();
gluQuadricNormals(quadric, GLU_SMOOTH);
glColor4f(0.6, 0.6, 0.6, 0.5);
renderSphere(x, y, z, radius, subdivisions, quadric);
gluDeleteQuadric(quadric);
glDisable(GL_BLEND);
}