25 lines
494 B
Haskell
25 lines
494 B
Haskell
|
{-# LANGUAGE OverloadedStrings #-}
|
||
|
module Renderer where
|
||
|
|
||
|
import qualified Graphics.Rendering.OpenGL as GL
|
||
|
|
||
|
import Control.Concurrent.STM
|
||
|
|
||
|
import Foreign.Ptr
|
||
|
|
||
|
-- internal imports
|
||
|
|
||
|
import Classes.Graphics
|
||
|
import Types.Graphics
|
||
|
|
||
|
draw :: VertexArray -> IndexBuffer -> Shader -> IO ()
|
||
|
draw va ib sp = do
|
||
|
bind sp
|
||
|
bind va
|
||
|
bind ib
|
||
|
count <- atomically $ readTVar $ iBufCount ib
|
||
|
GL.drawElements GL.Triangles count GL.UnsignedInt nullPtr
|
||
|
|
||
|
-- clear :: IO ()
|
||
|
-- clear = GL.clear [GL.ColorBuffer]
|