Reputation: 16588
Do I have to generate and bind a framebuffer for every renderbuffer I create? Or is there a chance to create renderbuffer only (and map it to a texture or submit somehow to the sahders)?
I just want to render to a one channel buffer to create some mask for later use. I think setting up a complete framebuffer would be overhead for this task.
Thanks.
Upvotes: 0
Views: 533
Reputation: 7400
You could use a stencil buffer instead, and just disable the stencil test until you are ready to mask your output.
edit: have a look at the following calls in the opengl docs:
glClearStencil
glClear(GL_STENCIL_BUFFER_BIT)
glEnable(GL_STENCIL_TEST)
glDisable(GL_STENCIL_TEST)
glStencilFunc
glStencilOp
http://www.opengl.org/sdk/docs/man/xhtml/glStencilFunc.xml
http://www.opengl.org/sdk/docs/man/xhtml/glStencilOp.xml
http://developer.nvidia.com/system/files/akamai/gamedev/docs/stencil.pdf?download=1
Upvotes: 1
Reputation: 473212
A renderbuffer is just an image. You cannot bind one as a texture; if you want to create an image to use as a texture, then you need to create a texture. That's why we have renderbuffers and textures: one of them is for things that you don't intend to read from.
Framebuffers are collections of images. You can't render to a rendebuffer or texture; you render to the framebuffer, which itself must have renderbuffers and/or textures attached to them.
You can either render to the default framebuffer or to a framebuffer object. The images in the default framebuffer can't be used as textures. So if you want to render to a texture, you have to use a framebuffer object. That's how OpenGL works.
"setting up a complete framebuffer" may involve overhead, but you're going to have to do it if you want to render to a texture.
Upvotes: 4