Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple render targets in one FBO with different size textures?

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!

like image 881
Max Feldkamp Avatar asked Sep 07 '13 22:09

Max Feldkamp


People also ask

Which shader outputs 2 textures to position 0 and 1?

Fragment shader 1: This is the first fragment shader which outputs 2 textures to position 0 and 1

What is the use of a renderbuffer?

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.

Is it possible to fill multiple textures in one pass?

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.


1 Answers

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

like image 167
Michael IV Avatar answered Nov 15 '22 09:11

Michael IV