I'm trying to draw a transparent object inside an opaque cage, but what ever I seem to try I can't get it right.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glColor4f(1.0, 1.0, 1.0, 1.0);
drawCage();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0, 0.0, 0.0, 0.5);
drawObject();
glPopAttrib();
This makes the transparent object within appear in front of the, despite it being inside it.
What am I doing wrong, could it be something to do with the shaders I am using