Multiple render targets in one FBO with different size textures?
Asked Answered
E

1

6

Can I have textures of different sizes attached to a single FBO, and then use those for multiple render targets? Will I need to do anything special with glViewport to make this happen? Suppose I have a 1024x1024 texture for COLOR_ATTACHMENT0 and a 512x512 texture for COLOR_ATTACHMENT1, and I call glDrawBuffers(2, {COLOR_ATTACHMENT0, COLOR_ATTACHMENT1}) (I realize that syntax is incorrect, but you get the idea...), will it render the full scene in both attachments? I'm chiefly thinking the utility of this would be the ability to render a scene at full quality and a down-sampled version at one go, perhaps with certain masks or whatever so it could be used in an effects compositor/post-processing. Many thanks!

Emeliaemelin answered 7/9, 2013 at 22:41 Comment(0)
P
4

Since GL3.0 you can actually attach textures of different sizes. But you must be aware that the rendered area will be the one of the smallest texture. Read here : http://www.opengl.org/wiki/Framebuffer_Object

Posner answered 7/9, 2013 at 22:54 Comment(2)
Fantastic! Does the whole scene get rendered to the full extent of each texture?Emeliaemelin
Also, you can effectively blit to another smaller or larger FBO to do up or downsampling.Posner

© 2022 - 2024 — McMap. All rights reserved.