Continue move to raw open gl
This commit is contained in:
+10
-5
@@ -2,7 +2,7 @@ module Shader.Compile (
|
||||
makeShader,
|
||||
makeByteStringShaderUsingVAO,
|
||||
makeShaderSized,
|
||||
-- makeShaderUsingShaderVAO,
|
||||
-- makeShaderUsingShaderVAO,
|
||||
makeShaderUsingVAO,
|
||||
setupVAO,
|
||||
setupVertexAttribPointer,
|
||||
@@ -226,12 +226,12 @@ makeShaderProgram str srcs = do
|
||||
shaders <- mapM (compileAndCheckShader str) srcs
|
||||
mapM_ (glAttachShader theprog) shaders
|
||||
glLinkProgram theprog
|
||||
glCheckError (str ++ " linking ") glGetProgramiv glGetProgramInfoLog theprog GL_LINK_STATUS
|
||||
checkErrorGL (str ++ " linking ") glGetProgramiv glGetProgramInfoLog theprog GL_LINK_STATUS
|
||||
mapM_ (glDetachShader theprog) shaders
|
||||
mapM_ glDeleteShader shaders
|
||||
return theprog
|
||||
|
||||
glCheckError ::
|
||||
checkErrorGL ::
|
||||
(Storable t1) =>
|
||||
[Char] ->
|
||||
(t2 -> GLenum -> Ptr t1 -> IO ()) ->
|
||||
@@ -239,7 +239,7 @@ glCheckError ::
|
||||
t2 ->
|
||||
GLenum ->
|
||||
IO ()
|
||||
glCheckError str f g x statustype =
|
||||
checkErrorGL str f g x statustype =
|
||||
alloca $ \statusPtr -> do
|
||||
f x statustype statusPtr
|
||||
status <- peek $ castPtr statusPtr
|
||||
@@ -257,7 +257,12 @@ compileAndCheckShader str (theShaderType, sourceCode) = do
|
||||
theShader <- glCreateShader theShaderType
|
||||
setShaderSource theShader sourceCode
|
||||
glCompileShader theShader
|
||||
glCheckError (str ++ shaderTypeExt' theShaderType) glGetShaderiv glGetShaderInfoLog theShader GL_COMPILE_STATUS
|
||||
checkErrorGL
|
||||
(str ++ shaderTypeExt' theShaderType)
|
||||
glGetShaderiv
|
||||
glGetShaderInfoLog
|
||||
theShader
|
||||
GL_COMPILE_STATUS
|
||||
return theShader
|
||||
|
||||
setShaderSource :: GLuint -> BS.ByteString -> IO ()
|
||||
|
||||
Reference in New Issue
Block a user