-
Hello, Thank you for these very extensive bindings! I have been using them to learn Haskell with Paul Hudak's Haskell School of Expression. So far so good but I can't seem to be able to draw a single pixel. I managed to draw other graphic primitives, but not a single pixel though the binding exists. Here is how I am doing it: module Main where
-- 1. Imports :
import Raylib.Core (clearBackground)
import Raylib.Core.Shapes (drawPixel, drawPixelV, drawTriangle)
import Raylib.Types(Vector2 (Vector2))
import Raylib.Util (drawing, whileWindowOpen0, withWindow)
import Raylib.Util.Colors (lightGray, red)
-- 2. Constants :
fbWidth, fbHeight :: Int
fbWidth = 160
fbHeight = 120
-- 3. Main Loop :
main :: IO ()
main = do
withWindow
fbWidth
fbHeight
"Ray Marching Demo"
60
( \window -> do
whileWindowOpen0
( drawing
( do
clearBackground lightGray
drawPixel 80 60 red
drawPixelV (Vector2 82 62) red
drawTriangle (Vector2 100 100) (Vector2 120 100) (Vector2 110 90) red
)
)
) This code does draw the red triangle, but not the 2 red pixels. Any suggestions? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I just asked a friend to give the code a try and the pixels properly draw on his machine. His version of Raylib is 4.6. Mine is 5.1. I just tried reproducing the code in C and the pixels do appear. |
Beta Was this translation helpful? Give feedback.
-
I ran your code and the pixels do appear for me, but the triangle is in a different position than the screenshot you attached. Is that from a previous version of the code? |
Beta Was this translation helpful? Give feedback.
-
Ah! I feel so stupid, updating should have been my first reflex. It all works now! I installed h-raylib about a month ago, probably a few days before the Raylib patch was published. Sorry I have taken some of your time for this. And thank you very much for the You guessed right, I am indeed trying to teach myself ray marching/ray tracing. Speed does not matter at this stage but thank you very much for the suggested code, as it will probably come in handy as some point. Thanks again! |
Beta Was this translation helpful? Give feedback.
If you are using 5.1.0.1, then this is a known bug with raylib. The C raylib version used by h-raylib 5.1.0.1 does not have the fix, h-raylib 5.1.1.0 does. This is the fix, which was committed only a month ago.