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!
Fragment shader 1: This is the first fragment shader which outputs 2 textures to position 0 and 1
A single RenderTexture object represents both color and depth buffers, but many complex rendering algorithms require using the same depth buffer with multiple color buffers or vice versa. hold the current renderbuffer info. As well as; controls which renderbuffers [] to write on from your shader which shares the same depthbuffer.
Your renderwithshader params are wrong by the way, read the documents. EDIT: if you need a good example, you can check my glow per object asset in the store. I did a bit of research on this... Of course, you can fill multiple textures in multiple passes if you don't care about your fps.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With