ClanLib 2.3 and ClanLib 2.4 had a problem on AMD GPU's when setting the frame buffer.

CL_OpenGLFrameBufferProvider::attach_color_buffer( ) had:

Code:
	glDrawBuffer(GL_COLOR_ATTACHMENT0);
	glReadBuffer(GL_COLOR_ATTACHMENT0);
If you put a CL_OpenGL::check_error() around the glReadBuffer, it reported INVALID_ENUM.

Looking at the specification:

"Arguments to DrawBuffer(s) and ReadBuffer when the context is bound to a framebuffer object, and the buffers they indicate. i in COLOR ATTACHMENTi may range from zero to the value of MAX COLOR ATTACHMENTS - 1."

(I emphasized "when the context is bound to a framebuffer object")

So I have commited to ClanLib 2.4 SVN a fixed version. Which appears to work.

However...

The new function is...


Code:
void CL_OpenGLFrameBufferProvider::bind_framebuffer(bool write_only)
{
	glBindFramebuffer(write_only ? GL_FRAMEBUFFER : GL_READ_FRAMEBUFFER, handle);

	if (count_color_attachments)
	{
		glDrawBuffer(GL_COLOR_ATTACHMENT0);
		glReadBuffer(GL_COLOR_ATTACHMENT0);
	}
	else
	{
		glDrawBuffer(GL_NONE);
		glReadBuffer(GL_NONE);
	}
}
Is this correct to call glDrawBuffer and glReadBuffer on the attachments even if you are or not going to read/write to it?