我正在整理帧缓冲区,并在我的场景中制作了一面镜子。除了深度测试外,它工作正常。被卡住试图让它工作。(当渲染到默认帧缓冲区时 - 深度测试工作正常)。将不胜感激任何帮助。这是代码:
glEnable( GL_DEPTH_TEST );
glViewport( 0, 0, 512, 512 );
unsigned int fbo;
glGenFramebuffers( 1, &fbo );
glBindFramebuffer( GL_FRAMEBUFFER, fbo );
unsigned int rbo;
glGenRenderbuffers( 1, &rbo );
glBindRenderbuffer( GL_RENDERBUFFER, rbo );
glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH, 512, 512 );
glBindRenderbuffer( GL_RENDERBUFFER, 0 );
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, rbo ); //if remove this, mirror works but without depth test
glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
this->mirror->texturePack[0]->textureId(), 0 );
//render scene from mirror camera
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glViewport( 0, 0, this->width(), this->height() );
//render scene from main camera