haskell-opengl / OpenGL

Haskell bindings to OpenGL
http://www.haskell.org/haskellwiki/OpenGL
BSD 3-Clause "New" or "Revised" License
147 stars 26 forks source link

Please consider exporting the internal marshaling functions #67

Open ekmett opened 9 years ago

ekmett commented 9 years ago

I've pretty much spent the last few hours hacking around the fact that I can't get at the GLenum's for an arbitrary ParameterizedTextureTarget in order to set up texture swizzling. =(

I basically wanted to:

    glTexParameter t gl_TEXTURE_SWIZZLE_R GL_RED
    glTexParameter t gl_TEXTURE_SWIZZLE_G GL_RED
    glTexParameter t gl_TEXTURE_SWIZZLE_B GL_RED
    glTexParameter t gl_TEXTURE_SWIZZLE_A GL_ONE

This would have been trivial and I could have continued to use the built in abstractions if we acknowledged that our abstractions leak as it is I pretty much had to give up on carrying on the abstraction through my own API.

If

class ParameterizedTextureTarget t where
   marshalParameterizedTextureTarget :: t -> GLenum
   marshalParameterizedTextureTargetProxy :: t -> GLenum
   marshalParameterizedTextureTargetEnableCap :: t -> EnableCap

exported the various marshal functions, I'd have been off to the races. There are dozens of these types sprinkled throughout the library.

What is gained from hiding the implementations of these classes? The ability to bump minor versions when you change how they are implemented?

You have lots of lovely little abstractions sprinkled around the OpenGL library. Please let us build atop them. =)