From sven.panne at aedion.de Mon Nov 6 12:41:31 2006 From: sven.panne at aedion.de (Sven Panne) Date: Mon Nov 6 12:41:08 2006 Subject: [HOpenGL] Specialized versions of renderPrimitives? In-Reply-To: <3d96ac180610280556n3aa6a909me538f2d20372e49c@mail.gmail.com> References: <200610281109.23678.sven.panne@aedion.de> <3d96ac180610280556n3aa6a909me538f2d20372e49c@mail.gmail.com> Message-ID: <200611061841.31889.sven.panne@aedion.de> 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. From sven.panne at aedion.de Tue Nov 14 13:37:38 2006 From: sven.panne at aedion.de (Sven Panne) Date: Tue Nov 14 13:36:53 2006 Subject: [HOpenGL] Finally: GLSL support Message-ID: <200611141937.38111.sven.panne@aedion.de> FYI: The OpenGL package has now partial support for GLSL. The API is not yet completely stable and support for generic vertex attribute arrays and querying vertex attributes and uniform variables is still missing (setting is of course already implemented). This is enough to run the "Hello, world!" of shader programming, the brick example from the Orange Book, see the attached pictures and the code at: http://darcs.haskell.org/packages/GLUT/examples/OrangeBook/ogl2brick/ If you want to test the new features, grab the latest packages via darcs: darcs get http://darcs.haskell.org/packages/OpenGL darcs get http://darcs.haskell.org/packages/GLUT Comments and suggestions are, as always, highly welcome. Cheers, S. -------------- next part -------------- A non-text attachment was scrubbed... Name: Brick1_small.png Type: image/png Size: 29752 bytes Desc: not available Url : http://www.haskell.org/pipermail/hopengl/attachments/20061114/e13941cd/Brick1_small-0001.png -------------- next part -------------- A non-text attachment was scrubbed... Name: Brick2_small.png Type: image/png Size: 58586 bytes Desc: not available Url : http://www.haskell.org/pipermail/hopengl/attachments/20061114/e13941cd/Brick2_small-0001.png