Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to attach the default renderbuffer to a FBO?

Tags:

opengl

fbo

I'm considering refactoring a large part of my rendering code and one question popped to mind: Is it possible to render to both the screen and to a texture using multiple color attachments in a Frame Buffer Object? I cannot find any information if this should be possible or not even though it has many useful applications. I guess it should be enough to bind my texture as color attachment0 and renderbuffer 0 to attachment1?

For example I want to make an interactive application where you can "draw" on a 3D model. I resolve where the user draws by rendering the UV-coordinates to a texture so I can look up at the mouse-coordinates where to modify the texture. In my case it would be fastest to have a shader that both draws the UV's to the texture and the actual texture to the screen in one pass.

Are there better ways to do this or am I on the right track?

like image 744
Andos Avatar asked Jan 24 '11 11:01

Andos


People also ask

What is an FBO in OpenGL?

The frame buffer object architecture (FBO) is an extension to OpenGL for doing flexible off-screen rendering, including rendering to a texture. By capturing images that would normally be drawn to the screen, it can be used to implement a large variety of image filters, and post-processing effects.

How do I render FBO?

Basically the steps are: Create FBO with depth renderbuffer and color texture attachment. To render to FBO unbind the target texture, bind FBO, render to FBO. Unbind FBO, bind texture, render. Show activity on this post.

What is color attachment?

A Colour attachment is a texture which attaches to a frame buffer as a render target, used for off-screen rendering. Colour attachments are used in several techniques, including reflection, refraction, and deferred shading.

What is a framebuffer Vulkan?

Framebuffers represent a collection of memory attachments that are used by a render pass instance. Examples of these memory attachments include the color image buffers and depth buffer that we created in previous samples.


1 Answers

There is no such thing as "default renderbuffer" in OpenGL. There is the window system provided default frame buffer with reserved name zero, but that basically means "no FBO enabled". So no, unfortunately normal OpenGL provides no method to somehow use its color buffer as a color attachment to any other FBO. I'm not aware of any extensions that could possible provide this feature.

With render buffers there is also the reserved name zero, but it's only a special "none" variable and allows unbinding render buffers.

like image 183
Tonttu Avatar answered Sep 17 '22 01:09

Tonttu