I have an application that uses only the default opengl framebuffer. It is initialized with color and depth buffer. I want to use the depth buffer as a uniform within a shader to access the current depth values. How can I make this happen? I tried to get the GLint ID of the depth buffer with the following command:
GLint params; glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms); std::cout << "Depthbuffer id:" << params << std::endl;
the output is something like 325462352776. so that doesn't work :(
How can I get the correct ID of the depth buffer so I can use it to read its values in a shader?