Hello everybody!

I have a small framework, written in C++, which renders a simple scene. Everything is fine. And now I'm trying to add reflection mapping. So I've created a cubemap and 6 cameras in order to render the whole scene to 6 2D-textures inside the cubemap. Let's name this rendering process as local.

The local rendering works with a custom framebuffer object. I create it once before all the rendering takes place:

Code :
    glGenFramebuffers (1, &oReflectionMap->_fbo);

Then every frame I perform the local rendering, where I do the following for each of the 6 2D-textures, mentioned above:

Code :
    glBindFramebuffer (GL_FRAMEBUFFER, _fbo);
    glFramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, iTextureIndex, _texture->GetTexId (), 0);
 
    glReadBuffer (GL_NONE);

Then I render the scene. And finally, I disable the fbo:

Code :
    glBindFramebuffer (GL_FRAMEBUFFER, 0);

The problem is that the depth testing for the local rendering doesn't work. The result of the rendering operation depends on the order of the objects in the rendering queue. Have I missed something? Btw, glIsEnabled (GL_DEPTH_TEST) says, that depth testing is enabled.