Edward Kmett | 28 Oct 2011 23:14
Picon
Gravatar

Graphics.Rendering.OpenGL.GL.Shaders API needlessly "helpful"

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


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 <at> (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
_______________________________________________
HOpenGL mailing list
HOpenGL <at> haskell.org
http://www.haskell.org/mailman/listinfo/hopengl

Gmane