Gl_FragColor = texture2D(DepthBuffer, tex_coord) And, the shader itself doesn't have any problem because when I assign another normal texture to the sampler, it renders the texture correctly. When I render my scene, the depth buffer is working correctly(depth test and depth write all working perfectly).īut, when I assign the depth buffer to the sampler in the shader and I render the depth buffer to the screen using full screen quad plane, it's all black. glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, pRD.BufferObjID,0) Self.Dimension = IVVec3I_Make(size.x, size.y, 0) Īnd attached it to the frame buffer as a depth attachment. GlTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, size.x, size.y, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL) So, I created a depth buffer as a 2D texture GLuint texture What I want to do is that I wanna get depth values of the scene in the depth buffer in a fragment shader. I'm working on a simple 3D application for OpenGL ES 2.0, iOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |