Set up the Shadow Framebuffer
main.cpp initRenderToDepthTexture()
glGenFramebuffers(1, &shadowFBO);
glBindFramebuffer(GL_FRAMEBUFFER, shadowFBO); // use the depth texture as the framebuffer
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_TEXTURE_2D, depthTex, 0);glDrawBuffer(GL_NONE); GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if( result == GL_FRAMEBUFFER_COMPLETE) {
printf("Framebuffer is complete.\n");
} else {
printf("Framebuffer is not complete.\n");
}
glBindFramebuffer(GL_FRAMEBUFFER,0);Last updated