{-# LANGUAGE OverloadedStrings #-}
module Renderer where

import Affection

import SDL (($=), get)

import qualified Graphics.Rendering.OpenGL as GL

import Data.String (fromString)

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]
