Also, the GLControl is creating a doublebuffered context - I don't know if this complicates things. Also, single buffering is the devil - I'd avoid subjecting my users to its ugliness. :-)
GL.DrawBuffer does work, you should check whether there are any GL.Errors and verify what buffer is set with GL.GetInteger( GetPName.DrawBuffer, etc.
Edit: Thanks for pointing at the DrawBuffer function, there's another inconsistency :P
Why do GL.DrawBuffer and GL.DrawBuffers use different enums? They're essentially the same, but DrawBuffers accepts an array of buffers.
I've also missed a couple of tokens when revisiting the enum, it should also contain the ColorAttachment0-15 tokens. If you bind a FBO it will automatically be set to ColorAttachment0 instead of the backbuffer.
Some code might be more clear:
DrawBuffersEnum[] bufs = new DrawBuffersEnum[2]{(DrawBuffersEnum) FramebufferAttachment.ColorAttachment0Ext, (DrawBuffersEnum) FramebufferAttachment.ColorAttachment1Ext};
GL.DrawBuffers( bufs.Length, bufs );
GL.GetInteger( GetPName.DrawBuffer0, out temp ); // temp==ColorAttachment0, addressed with gl_FragData[0]GL.GetInteger( GetPName.DrawBuffer1, out temp ); // temp==ColorAttachment1, addressed with gl_FragData[1]
Edit Again: Could it be that the front buffer is protected in some way in double buffered contexts?
Comments
Re: GL.WriteBuffer missing
glDrawBuffer might be what you're looking for?
Re: GL.WriteBuffer missing
I can't find mention of that function anywhere in the specs or the manual, or even the mesa3d headers.
A quick google search returns about 7 results - are you sure such a function exists?
Re: GL.WriteBuffer missing
Ahh! DrawBuffer is the one, thank you!
Re: GL.WriteBuffer missing
DrawBuffer seems not to work. Shouldnt this sample show the same output if the doublebuffer flag is toggled??:
Re: GL.WriteBuffer missing
I think you are missing a
GL.Flush()call:Also, the GLControl is creating a doublebuffered context - I don't know if this complicates things. Also, single buffering is the devil - I'd avoid subjecting my users to its ugliness. :-)
Re: GL.WriteBuffer missing
GL.DrawBuffer does work, you should check whether there are any GL.Errors and verify what buffer is set with
GL.GetInteger( GetPName.DrawBuffer, etc.Edit: Thanks for pointing at the DrawBuffer function, there's another inconsistency :P
Why do GL.DrawBuffer and GL.DrawBuffers use different enums? They're essentially the same, but DrawBuffers accepts an array of buffers.
I've also missed a couple of tokens when revisiting the enum, it should also contain the ColorAttachment0-15 tokens. If you bind a FBO it will automatically be set to ColorAttachment0 instead of the backbuffer.
Some code might be more clear:
Edit Again: Could it be that the front buffer is protected in some way in double buffered contexts?