[HOpenGL] Specialized versions of renderPrimitives?

Sven Panne sven.panne at aedion.de
Mon Nov 6 12:41:31 EST 2006


Am Samstag, 28. Oktober 2006 14:56 schrieb Sebastian Sylvan:
> [...]
> I'd much rather effort is spent trying to support some of the newer
> features of OpenGL (shaders!), as that is kind of a deal-breaker for
> me.

"Listen to your customers!" :-) OK, I've started to make a binding of the GLSL 
API in the OpenGL package. It currently still misses the parts to specify 
uniform variables and user-defined vertex attributes, but apart from that it 
should be complete:

http://haskell.org/HOpenGL/newAPI/OpenGL/Graphics-Rendering-OpenGL-GL-Shaders.html

Haddock comments are still missing, but the module should be self-explaining 
for people who know the latest OpenGL spec. A few remarks about the design:

   * Shaders are only dynamically typed in OpenGL itself, but the Haskell 
binding statically distinguishes vertex shaders and fragment shaders, and a 
type class is used for common operations. Apart from being a bit cleaner, 
this enables both kind of shaders to be an instance of ObjectName.

   * compileShader, linkProgram and validateProgram return () and not Bool, 
although probably most of the time the correspoding getter will be used 
immediately afterwards to check the result of the operation. This is done to 
keep "the spirit" of OpenGL and enables easy checks in a completely different 
part of the program.

   * glAttachShader, glDetachShader and glGetAttachedShaders are unified into 
a single state variable, because the attached shaders are semantically simply 
a part of the program state in question. Separate API entries are very 
probably not needed just because of performance reasons.

I hope that I'll implement the missing GLSL API parts soon, including some 
examples from the Yellow Book, but it would be great to get some feedback at 
this early stage already.

Cheers,
   S.



More information about the HOpenGL mailing list