Closed jxv closed 6 years ago
I'm guessing some state isn't being set with the circle geometry opposed to the pictures with triangle or bezier curve geometries.
Current workaround is to draw a black square at the beginning of every frame.
import qualified SDL as SDL import Control.Arrow import Linear hiding (angle) import Control.Monad.Except (runExceptT) import System.Exit (exitSuccess) import Control.Monad (forever, when) import Control.Concurrent (threadDelay) import Gelatin import Gelatin.SDL2 hiding (rotate) blackSquarePic :: ColorPicture () blackSquarePic = setGeometry $ triangles tris where tris = do tri (0, black) (V2 100 0, black) (100, black) tri (0, black) (V2 0 100, black) (100, black) circlePic :: ColorPicture () circlePic = do setStroke [StrokeWidth 3, StrokeFeather 1] setGeometry $ line $ mapVertices (\v -> (v, white)) (arc 10 10 0 (2 * pi)) isQuit :: SDL.Event -> Bool isQuit (SDL.Event _ payload) = isKeyQ payload || payload == SDL.QuitEvent where isKeyQ (SDL.KeyboardEvent (SDL.KeyboardEventData _ _ _ (SDL.Keysym _ SDL.KeycodeQ _))) = True isKeyQ _ = False main :: IO () main = do runExceptT (startupSDL2Backends 1000 600 "Black Square for Circle" True) >>= \case Left _ -> return () Right backends@(SDL2Backends glv2v4 _glv2v2) -> do (_, circleRender) <- compilePicture glv2v4 circlePic (_, blackSquareRender) <- compilePicture glv2v4 blackSquarePic forever $ do threadDelay 1 events <- getEvents glv2v4 when (any isQuit events) exitSuccess clearWindow glv2v4 snd blackSquareRender [] -- Toggle blackSquareRender to draw circle (or not!) snd circleRender [move 300 300] updateWindow glv2v4
Yeah, that's funky - thanks for the report! I'll investigate and push a fix ASAP.
Nice catch @jxv - turns out the color line renderer was not properly setting the projection matrix. Should be fixed on master.
I'm guessing some state isn't being set with the circle geometry opposed to the pictures with triangle or bezier curve geometries.
Current workaround is to draw a black square at the beginning of every frame.