-
MRT efficiency to avoid useless rendering
Hi,
my app uses 1 FBO with 2 color attachments.
the main loop alogorithm is basic :
bind the mrt
render the scene
unbind
render the scene (to GL_BACK).
Unfortunatelly, I have a performance issue. A single render pass is very expensive and I would like to avoid one pass.
The best solution would be to have a MRT with 3 attachments : GL_BACK and 2 GL_COLOR_ATTACHMENT.
AFAIK, this is not possible : in glsl gl_FragData could only be used to write into a color_attachement and we can't use gl_FragData and gl_FragColor in the same time.
Am I right ?
If I am wrong
PLEASE tell me how to do!!!
else :
So I can render my scene into 3 color attachements, and then copy the content of one fbo texture into GL_BACK.
My goal is then to find the most efficient way to copy.
The GL_EXT_framebuffer_blit extension provide the fastest copy from one fbo to another. Does a similar method exist to copy/swap a fbo texture to the back buffer ?
The only way I know to do that would be to use a quad and use a texture on it.
Is there a better solution ?
thanks!
-
Advanced Member
Frequent Contributor
Re: MRT efficiency to avoid useless rendering
GL_EXT_framebuffer_blit also allows you to blit between an application created FBO and the window provided framebuffer.
Just set GL_DRAW_FRAMEBUFFER_EXT to 0 if you want it to write to the window provided framebuffer.
-
Re: MRT efficiency to avoid useless rendering
Great ! Thanks a lot!
Is it possible to specify the color_attachement like that ?
BindFramebufferEXT(READ_FRAMEBUFFER_EXT, 2);
glReadBuffer(GL_COLOR_ATTACHMENT3_EXT);
BindFramebufferEXT(DRAW_FRAMEBUFFER_EXT, 0);
BlitFramebufferEXT(0, 0, 640, 480,
0, 0, 640, 480,
GL_COLOR_BUFFER_BIT,
GL_NEAREST);
-
Advanced Member
Frequent Contributor
Re: MRT efficiency to avoid useless rendering
According to the spec this should be possible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules