[HOpenGL] Graphics.Rendering.OpenGL.GL.Shaders API needlessly "helpful"

Edward Kmett ekmett at gmail.com
Fri Oct 28 23:14:22 CEST 2011


Is there any thought as to a better way to deal with

https://github.com/haskell-opengl/OpenGL/blob/master/Graphics/Rendering/OpenGL/GL/Shaders.hs?

If you have code that dynamically constructs and deletes single shaders
frequently, the API exposed there just introduces O(n) overhead for every
such construction.


*setAttachedShaders* :: Program -> ([VertexShader],[FragmentShader]) -> IO ()
setAttachedShaders p@(Program program) (vs, fs) = do
   currentIDs <- getAttachedShaderIDs p
   let newIDs = map shaderID vs ++ map shaderID fs
   mapM_ (glAttachShader program) (newIDs \\ currentIDs)
   mapM_ (glDetachShader program) (currentIDs \\ newIDs)

-Edward Kmett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/hopengl/attachments/20111028/ec20ed29/attachment.htm>


More information about the HOpenGL mailing list