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

OpenGL does not expose all uniform functionality. #14

Closed ghost closed 8 years ago

ghost commented 13 years ago

Sometimes I want to use glUniform*, but the OpenGL UniformLocation type does not work with it. I have to unsafeCoerce it to the underlying GLint and use that. If the OpenGL API exposed all the uniform api, it wouldn't be an issue.

To be honest, I think OpenGL might be built too far above the raw bindings. Maybe it should just add type discipline to the GLRaw functions.

Laar commented 13 years ago

Looking at ...Shaders.hs it seems to me that the most important types (GLint, GLuint, GLfloat) are present. Having said that, it looks like the following is missing:

ghost commented 13 years ago

The library uses Statevars to deal with samplers. Perhaps that ought to be the case with all uniforms, but I don't know how that would work.

On Sat, May 28, 2011 at 5:01 AM, Laar < reply@reply.github.com>wrote:

Looking at ...Shaders.hs it seems to me that the most important types (GLint, GLuint, GLfloat) are present. Having said that, it looks like the following is missing:

  • Matrix functionality
  • Samplers It might also be nice to implement the functions for GLboolean and some other types that can be converted (e.g. GLdouble).

Reply to this email directly or view it on GitHub: https://github.com/haskell-opengl/OpenGL/issues/14#comment_1253504

svenpanne commented 8 years ago

The matrix part has been added in b1b50031f7880b918fc6ec056342c5c89f118213, I'm about to make a new release on Hackage.

Samplers are already supported (TextureUnit is an instance of Uniform), and you can pass image uniforms via the GLint instance, so I think all necessary functionality is exposed.