shaders now compile and link correctly

- map still invisible
- frustum defined
- shaders fixed
- attrib-link to shaders fixed
- lookat now generates a frustum-projected look-at matrix
- smaller test-map for debug
This commit is contained in:
Stefan Dresselhaus
2014-01-03 17:46:41 +01:00
parent e5193fc7c5
commit 7d201cf216
6 changed files with 110 additions and 27 deletions

View File

@ -38,21 +38,28 @@ initShader = do
! vertexSource <- B.readFile vertexShaderFile
! fragmentSource <- B.readFile fragmentShaderFile
vertexShader <- compileShaderSource VertexShader vertexSource
checkError "compile Vertex"
fragmentShader <- compileShaderSource FragmentShader fragmentSource
checkError "compile Frag"
program <- createProgramUsing [vertexShader, fragmentShader]
checkError "compile Program"
currentProgram $= Just program
projectionMatrixIndex <- get (uniformLocation program "fg_ProjectionMatrix")
checkError "projMat"
colorIndex <- get (attribLocation program "fg_Color")
vertexAttribArray colorIndex $= Enabled
vertexIndex <- get (attribLocation program "fg_Vertex")
vertexAttribArray vertexIndex $= Enabled
checkError "colorInd"
normalIndex <- get (attribLocation program "fg_Normal")
vertexAttribArray normalIndex $= Enabled
checkError "normalInd"
vertexIndex <- get (attribLocation program "fg_VertexIn")
vertexAttribArray vertexIndex $= Enabled
checkError "vertexInd"
checkError "initShader"
return (colorIndex, normalIndex, vertexIndex, projectionMatrixIndex)