Closed Metric closed 4 years ago
Usability the degree to which something is able or fit to be used.
Why don't you pass the wanted GL enumeration value to a Gl.DrawBuffers
call? (note the 's') Just like here in the sample?
Or... maybe are you asking why there is no DrawBufferMode
overload of glDrawBuffers
, and why DrawBufferMode
is missing lot of values? Here is the story: the GL specifications had neglected "enumerations" definitions for long time (of course, the official C headers couldn't take advantage from them); consequently, all GL bindings that may take advantage from enumerations are sometimes penalized.
If you are a willing to improve the OpenGL.NET API, just make a pull request the official specification repository after having updated this project. There is a lot of work to do (i.e. here you can find a recent modification).
Anyway the effort for extending DrawBufferMode
is not worth it: just use Gl.DrawBuffers
with variadic int
overload:
Gl.DrawBuffer
bring us back to 1996: it's defined in OpenGL 1.0 and assumes single buffer H/W (infact DrawBufferMode
defines removed/deprecated constants)Gl.DrawBuffers
is the way to go, as defined by OpenGL 2.0. If you need a single buffer, just pass a GL constant (variadic overloads are soo cool in C#).Gl.DrawBuffers
is possible, but painful. Usually, Gl.DrawBuffers
is used with an addition operation (i.e. Gl.DrawBuffers(Gl.COLOR_ATTACHMENT0 + x);
), leading to a cast. (and the maximum number of attachment is H/W dependent, you need to query the number at runtime).Gl.DrawBuffer
: only Gl.DrawBuffers
(if you want to run on mobile also).In short: use Gl.DrawBuffers.
From OpenGL Documentation for glDrawBuffer() For framebuffer objects, GL_COLOR_ATTACHMENT$m$ and GL_NONE enums are accepted, where $m$ is a value between 0 and GL_MAX_COLOR_ATTACHMENTS.
DrawBufferMode enum is completely missing these values for GL_COLOR_ATTACHMENT. And thus OpenGL.DrawBuffer is completely unusable for Framebuffers at the moment. OpenGL.ReadBufferMode does include these values already and thus OpenGL.ReadBuffer is usable.