Is it better to have 2 smaller render targets or one large one?
c++, glsl, opengl
Solution
The lesser buffer bind/rebind operations you use - the better.
Even more, in your case you're good with just 4 floats: RGB+Specular. So use the full 128-bit rendertarget and pack the (r,g,b,specular) values. It must be better because the access to different memory locations (96 bits for rgb and 32 more for the specular) is bad for cache.
One render target is also better for the older videocards. Anyways, when you use only 96 bits you're wasting memory. The g-buffer always has to be tightly packed.
Problem
I am writing a deferred renderer, and am trying to pack my gbuffer. Would it be better to store the diffuse and specular together: ``` vec4 difSpec = (diffuse.xyz, specular) // FORMAT_RGBA gl_FragData[0] = difSpc; ``` or to use 2 render targets ``` vec3 diffuse float specular gl_FragData[0] = diffuse // FORMAT_RGB gl_FragData[1] = specular // FORMAT_RED ``` The question is would one be better than the other and why.