I have created two cubes ,which have two different textures .What i want to do is make the one transparent. My InitGl is as follows
int InitGL(GLvoid)
{
if (!LoadGLTextures())
{
return FALSE;
}
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glColor4f(1.0f, 1.0f, 1.0f, 0.5);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
return TRUE;
}
When drawing the first cube (which i want to have transparent) i have the folowing code in my DrawGLScene
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
…
glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
then i draw the second cube
Anyone knows what i do wrong?