cginternals / gloperate

C++ library for defining and controlling modern GPU rendering/processing operations.
MIT License
43 stars 26 forks source link

Unable to clear color buffers other than 0 #398

Open j-o opened 7 years ago

j-o commented 7 years ago

ClearStage uses RenderInterface::obtainFBO(size_t index, AbstractRenderTarget * renderTarget) to get an FBO for a specific attachment. This overload does not set draw buffers and neither does the clear stage. This works for color buffer 0, as the default value for the draw buffers array is [GL_COLOR_ATTACHMENT0, GL_NONE, GL_NONE, ...] (see https://computergraphics.stackexchange.com/a/3937), but fails for any additional color buffer.

Who should be responsible for seting the draw buffers?

Tobias1595 commented 6 years ago

About the responsibility for setting the draw buffers: RenderInterface::obtainFBO(size_t index, AbstractRenderTarget * renderTarget) returns the FBO held internally by the RenderInterface (or the default FBO). Therefore each Stage that uses this method has its own FBO with its own draw buffer configuration. Consequently each Stage has to specify which buffers to draw to if the default mentioned above is insufficient.