Hi all!
I’ve seen lots of tutorials that show how to send multiple color texture from 1 FBO to a fragment shader but none about my problem.
I’m trying to send both a color buffer and the depth buffer of a FBO to a fragment shader, and Actually, I success to send either 1 or the other, but not together.
I’m initializing well (I believe, since I can modify the Texture i’m sending by changing
glBindTexture(GL_TEXTURE_2D, visibilityFBO.getColorTexture());
to
glBindTexture(GL_TEXTURE_2D, visibilityFBO.getDepthTexture());
).
In the fragment, I have
uniform sampler2D screenTexture;
uniform sampler2D depthTexture;
but the 2 are fill with the same texture (depth or color). Even with trying to use
glActiveTexture(GL_DEPTH) after glActiveTexture(GL_TEXTURE0), it doesn’t work. I’m lost, here
Can someone help me understand how I can make it?
Thanks a lot!!
EDIT : Problem solved… after 3 days working on the subject, I found the subject 1 hour after having post the post… The way to do it is
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, visibilityFBO.getColorTexture());
glUniform1i(glGetUniformLocation(visibilityPassShader.Program, "positionTexture"), 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, visibilityFBO.getDepthTexture());
glUniform1i(glGetUniformLocation(visibilityPassShader.Program, "depthTexture"), 1);