
28 Oct
2011
28 Oct
'11
5:14 p.m.
Is there any thought as to a better way to deal with https://github.com/haskell-opengl/OpenGL/blob/master/Graphics/Rendering/Open... 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