What does this runtime error mean?

10 views
Skip to first unread message

Jasper Peters

unread,
Oct 29, 2019, 8:54:54 PM10/29/19
to Haskell Gloss
I don't know what this error even means, making it rather difficult to fix.

The error:
gloss-counter.exe: Gloss / OpenGL Internal Error "after drawPicture."
  Please report this on haskel...@googlegroups.com.
Error InvalidValue "invalid value"

CallStack (from HasCallStack):
  error, called at .\Graphics\Gloss\Internals\Rendering\Picture.hs:282:9 in gloss-rendering-1.13.1.1-7QEDWgudtNYHXOVIyq7OAT:Graphics.Gloss.Internals.Rendering.Picture



Code (View.hs):
-- | This module defines how to turn
-- the game state into a picture
module View where

import Graphics.Gloss
import Model

view :: GameState -> IO Picture
view gState@GameState{textures = ts} = do
x <- ts
return (viewPure gState x)

viewPure :: GameState -> [Picture] -> Picture
viewPure gstate@GameState {pakMan = p} ts = drawPakMan p ts --pictures ( map (\(f,o) -> f o ts) [(drawPakMan, p)] )

pakManSpritePos :: Int
pakManSpritePos = 0
ghostSpritePos = 4
tileSpritePos = 8

drawPakMan :: PakMan -> [Picture] -> Picture
drawPakMan p@(PakMan (Pos x y) d _) ps = translate2Screen x y (ps !! ( (pakManSpritePos) + (directionToOffset d) )) --

directionToOffset :: Direction -> Int
directionToOffset DUp = 0
directionToOffset DDown = 1
directionToOffset DLeft = 2
directionToOffset DRight = 3

translate2Screen :: Int -> Int -> Picture -> Picture
translate2Screen x y = translate (fromIntegral $ x-640) (fromIntegral $ -y+360)


If more code is needed please ask!

Ben Lippmeier

unread,
Oct 29, 2019, 9:03:51 PM10/29/19
to haskel...@googlegroups.com, Jasper Peters
Weird. I don’t see anything suspicious about the code itself. I should be able to look at it over the weekend, along with the other recent bug report.

Ben.


--
You received this message because you are subscribed to the Google Groups "Haskell Gloss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-glos...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-gloss/1310c012-f93b-45b0-88c3-10272430fa7a%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages