28 Oct 2011 23:14
Graphics.Rendering.OpenGL.GL.Shaders API needlessly "helpful"
Edward Kmett <ekmett <at> gmail.com>
2011-10-28 21:14:22 GMT
2011-10-28 21:14:22 GMT
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
RSS Feed