Hello,
I am trying to use the auxiliary color buffers to store information for deferred shading but they always just end up filled with black. Here are the relevant code snippets…
// in the renderer
GLenum rt[] = { GL_BACK, GL_AUX0, GL_AUX1, GL_AUX2 };
glDrawBuffers(4, rt);
// when i read the buffers into textures…
glReadBuffer(glrt); // ← I’ve confirmed these are GL_AUX0… GL… etc
glCopyTexImage2D(GL_TEXTURE_2D,
0,
_component,
0, 0,
_uwidth, _uheight,
0);
// in the shader
gl_FragData[0].rgb =
sun_contribution
+ moon_contribution
+ ambient_contribution;
gl_FragData[0].a = 1.0;
gl_FragData[1] = vec4(0.0, 1.0, 0.0, 0.0);
gl_FragData[2] = vec4(0.0, 1.0, 0.0, 0.0);
gl_FragData[3] = vec4(0.0, 1.0, 0.0, 0.0);
Is there some kind of setup I am missing to use these buffers? Any tips would be appreciated.