I am new to Haskell and I am building a chess game using OpenGL
(using Graphics.UI.GLUT
) for UI. I am trying to render PNG images for chess pieces.
I read that images can be converted to TextureObject
and then rendered, but could not find any helpful resources to know how to do it.
This is what my code looks like for generating the chess board
drawSquare :: BoardSquare -> IO ()
drawSquare ((x,y,z),(r,g,b)) = preservingMatrix $ do
color $ Color3 r g b
translate $ Vector3 x y z
drawCube -- this will draw a square of appropriate size
-- Display Callback
display :: IORef GameState -> DisplayCallback
display gameState = do
gstate <- get gameState
clear [ColorBuffer]
forM_ (getBoardPoints gstate) $ drawSquare -- drawing all 64 squares here
flush
Can anyone help me render PNG image at any given x
and y
coordinates of the window with given file path?