Hi,
I have a framebuffer I use for storing the color and depth buffer after drawing the environment of my simulation (the camera moving seldom, it’s better to blit it if possible).
Problem is, the depth is not blited, therefor when i draw the mobile elements, well, no depth buffer. Tried playing with multisample, with glDepthMask, with GL_DEPTH_COMPONENT precision, no change.
Blitting to buffer after each camera displacement :
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, BackupFBO);
glBlitFramebuffer(0, 0, currentWindowWidth, currentWindowHeight,
0, 0, currentWindowWidth, currentWindowHeight,
GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
Blitting from buffer when no movement:
glBindFramebuffer(GL_READ_FRAMEBUFFER, BackupFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, currentWindowWidth, currentWindowHeight,
0, 0, currentWindowWidth, currentWindowHeight,
GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
Framebuffer creation :
glGenRenderbuffers(1, &BackupFBO_colorRBO);
glBindRenderbuffer(GL_RENDERBUFFER, theatreBackupFBO_colorRBO);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, openGLFSAASamples, GL_RGBA, 1920, 1080);
glGenRenderbuffers(1, &BackupFBO_depthRBO);
glBindRenderbuffer(GL_RENDERBUFFER, theatreBackupFBO_depthRBO);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, openGLFSAASamples, GL_DEPTH_COMPONENT32, 1920, 1080);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glGenFramebuffers(1, &BackupFBO);
glBindFramebuffer(GL_FRAMEBUFFER, BackupFBO);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, BackupFBO_colorRBO);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, BackupFBO_depthRBO);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
Something I missed ?
depthbuffer is active all along, the code path is exactly the same in both cases…
I’ve got no clue.
edit : forgot an essential part … Firepro v5800, latest drivers, win7 64.