Sorry for the confusing and technically propably wrong title, but I could not come up with anything better :).
I am currently thinking what would be necessary for a simple deferred shading FBO and I came to the conclusion that it would be the best to only save the depth, to recover the position later on (to have the possibility to add more shading features later on).- Even though since I have never really wrote the Depth to a texture I dont really know how the FBO for that should look like.- For now I always just added a depth buffer like this:
glGenRenderbuffersEXT(1, &depthBuffer); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBuffer); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width, height); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBuffer);
But I saw that you can also bind a texture to an FBO and define its internal format as the GL_DEPTH_COMPONENT, so I was wondering what would make more sense in my case, and if I would use the texture as a depth attachment, would I also add the “normal” depthbuffer?
it would be ideal to just use one texture for high precision depth, and the three other ones for material information and normals. the depth in a GL_DEPTH_COMPONENT texture is written automatically right? are there any good examples on how to use them and with which texture parameters?