Login  Register

how can i display the depth / stencil buffer?

classic Classic list List threaded Threaded
3 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

how can i display the depth / stencil buffer?

imakerobots
71 posts
My nephew is playing with ShaderToy all the time.  For him it's really easy to display the various layers he's working with - depth, stencil, etc.

I want a simple way to provide him the same ability.  Can someone please show me how to do this right?

I've tried glReadPizels to a buffer.  I get an insufficient memory error on the thread for trying to allocate ~500kb.

I've tried glBlitFramebuffer to copy the 8 bit stencil buffer to the back buffer.  There I get a "GL error 1282: invalid operation" on the next shader call.  Somehow GL3 thinks that I'm not bound to the default framebuffer even though I double checked every bind is paired with a gl3.glBindFramebuffer(GL3.GL_FRAMEBUFFER,0), guaranteed in a finally()...

I have successfully mapped the shadow buffer from my lighting system to a texture and displayed that in the past (https://github.com/MarginallyClever/Robot-Overlord-App/blob/45d63c5b4c9a180451c78711e197c0a9323e87bf/src/main/java/com/marginallyclever/ro3/apps/viewport/renderpass/DrawMeshes.java#L142)... so maybe I shouldn't use the system capabilities to create the stencil buffer and instead should create a separate FBO?  idk.

Any advice at all would be greatly appreciated.  Thank you!
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: how can i display the depth / stencil buffer?

Sven Gothel
Administrator
2960 posts
It is correct that you need to use a depth texture attached to your FBO,
which then can be used in a later rendering stage to be read.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: how can i display the depth / stencil buffer?

imakerobots
71 posts
Ok, I've already had that one solved before I started this thread.

What about the stencil buffer?