Puma1140
12-23-2003, 07:16 AM
I have this code:
void render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(transx,0.0f,transz);
glRotatef(rotx,1.0f,0.0f,0.0f);
glRotatef(roty,0.0f,1.0f,0.0f);
glBindTexture(GL_TEXTURE_2D,texture[1]);
gluSphere(quadric,0.3f,30,30);
if (blending) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glColor4f(1.0f,1.0f,1.0f,0.5f);
}
else {
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawCube(0.0f,0.0f,0.0f,1.0f);
glutSwapBuffers();
}
When I press b, I have blending...but both cube and sphere are transparent..I want only the cube to be transparent. I tried to draw the sphere after the cube and although it wasn't transparent, it didn't look it was IN the cube. Any suggestions?
void render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(transx,0.0f,transz);
glRotatef(rotx,1.0f,0.0f,0.0f);
glRotatef(roty,0.0f,1.0f,0.0f);
glBindTexture(GL_TEXTURE_2D,texture[1]);
gluSphere(quadric,0.3f,30,30);
if (blending) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glColor4f(1.0f,1.0f,1.0f,0.5f);
}
else {
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
glBindTexture(GL_TEXTURE_2D, texture[0]);
DrawCube(0.0f,0.0f,0.0f,1.0f);
glutSwapBuffers();
}
When I press b, I have blending...but both cube and sphere are transparent..I want only the cube to be transparent. I tried to draw the sphere after the cube and although it wasn't transparent, it didn't look it was IN the cube. Any suggestions?