flickering triangle (rendering cube)

This commit is contained in:
tpajenka
2014-01-04 02:53:12 +01:00
parent a2c1effb48
commit 33b1ec5534
5 changed files with 56 additions and 29 deletions

View File

@ -33,7 +33,7 @@ initBuffer varray =
checkError "initBuffer"
return bufferObject
initShader :: IO (AttribLocation, AttribLocation, AttribLocation, UniformLocation)
initShader :: IO (AttribLocation, UniformLocation)
initShader = do
! vertexSource <- B.readFile vertexShaderFile
! fragmentSource <- B.readFile fragmentShaderFile
@ -49,20 +49,12 @@ initShader = do
projectionMatrixIndex <- get (uniformLocation program "fg_ProjectionMatrix")
checkError "projMat"
colorIndex <- get (attribLocation program "fg_Color")
vertexAttribArray colorIndex $= 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)
return (vertexIndex, projectionMatrixIndex)
initRendering :: IO ()
initRendering = do