One section of the OpenGL ES 3.0 spec is not completely clear to me.
If an OpenGL ES Shading Language 1.00 fragment shader writes to gl_FragColor or gl_FragData, DrawBuffers specifies the draw buffer, if any, into which the single fragment color defined by gl_FragColor or gl_FragData is written. If an OpenGL ES Shading Language 3.00 fragment shader writes a user-defined varying out variable, DrawBuffers specifies a set of draw buffers into which each of the multiple output colors defined by these variables are separately written.
I understand this the following way:
- If I use OpenGL Es 3.0 and write shaders using GLSL 1.0, then the only way I can write to 2 buffers at once (COLOR0 and COLOR1) is to manually specify what gets written to gl_FragData and gl_FragData in my fragment shader. If I then want to get back to writing only to COLOR0, I must switch glPrograms.
- If on the other hand I use OpenGL ES 3.0 and write my shaders using GLSL 3.0, then I can simply define my output using a single varying out variable, and dynamically switch on and off writing to COLOR1 with calls to DrawBuffers() and with no need to swap glPrograms.
Is the above correct?