luca-piccioni / OpenGL.Net

Modern OpenGL bindings for C#.
MIT License
567 stars 107 forks source link

DrawBufferMode Missing Enums for ColorAttachments #148

Closed Metric closed 4 years ago

Metric commented 4 years ago

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.

luca-piccioni commented 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:

In short: use Gl.DrawBuffers.