From 32f1043d7c931afa343e9ac361510ec0344ec02e Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Tue, 10 Jun 2014 23:37:05 +0200 Subject: [PATCH] minor cleanup --- src/Importer/IQM/Parser.hs | 12 ++++++------ src/Render/Render.hs | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Importer/IQM/Parser.hs b/src/Importer/IQM/Parser.hs index be0351e..b600f3f 100644 --- a/src/Importer/IQM/Parser.hs +++ b/src/Importer/IQM/Parser.hs @@ -231,18 +231,18 @@ parseIQM a = createVAO :: [(IQMVertexArray, BufferObject)] -> IO () createVAO bo = do - print bo - initVAO (AttribLocation 0) IQMPosition bo - initVAO (AttribLocation 1) IQMNormal bo - initVAO (AttribLocation 2) IQMTexCoord bo + print bo + initVAO (AttribLocation 0) IQMPosition bo + initVAO (AttribLocation 1) IQMNormal bo + initVAO (AttribLocation 2) IQMTexCoord bo initVAO :: AttribLocation -> IQMVertexArrayType -> [(IQMVertexArray, BufferObject)] -> IO () initVAO l t bo = do - print t + print $ concat ["adding ", show t, " to vertexBufferObject"] let (IQMVertexArray _ _ _ num _ _,buf) = case filter (\(IQMVertexArray ty _ _ _ _ _, _) -> ty == t) bo of [(a,b)] -> (a,b) _ -> error "IQM-Object not render-able with current shader-mechanics" - bindBuffer (toBufferTargetfromVAType t)$= Just buf + bindBuffer (toBufferTargetfromVAType t) $= Just buf vertexAttribArray l $= Enabled vertexAttribPointer l $= (ToFloat, VertexArrayDescriptor num Float 0 nullPtr) diff --git a/src/Render/Render.hs b/src/Render/Render.hs index 7926418..0d76d4e 100644 --- a/src/Render/Render.hs +++ b/src/Render/Render.hs @@ -288,7 +288,9 @@ renderIQM :: IQM -> L.V3 CFloat -> L.V3 CFloat -> IO () renderIQM m p@(L.V3 x y z) s@(L.V3 sx sy sz) = do bindVertexArrayObject $= Just (vertexArrayObject m) let n = num_vertexes.header $ m + --print $ concat ["drawing ", show n," triangles from object ",show m] glDrawArrays gl_TRIANGLES 0 (fromIntegral n) + checkError "drawing model" return () renderObject :: MapObject -> IO ()