From a5880684868824b34689df4589106730ad1c7fc0 Mon Sep 17 00:00:00 2001 From: Csaba Hruska Date: Fri, 21 Sep 2018 20:01:13 +0300 Subject: pickInt: sample from mouse position as well --- examples/pickInt.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/pickInt.hs b/examples/pickInt.hs index 36bc36c..2703e91 100644 --- a/examples/pickInt.hs +++ b/examples/pickInt.hs @@ -64,11 +64,14 @@ main = do toScreen = screenM screenW screenH "viewProj" @= pure (mat4ToM44F $! (Vc.fromProjective $! Vc.translation cvpos) Vc..*. toScreen) + (curX, curY) <- GLFW.getCursorPos win let pickPoints = -- should be fb 0 fb 1 (pick) - [ (0, 0) -- black 0 + [ (clamp curX 800, clamp curY 600) + , (0, 0) -- black 0 , (200, 200) -- ..blue, ffff0000 2 , (600, 400) -- ..red, ff0000ff 1 ] :: [(Int, Int)] + clamp v m = min (pred m) $ max 0 (floor v) -- render to render texture LambdaCubeGL.renderFrame pipePick @@ -186,3 +189,4 @@ initWindow title width height = do Just win <- GLFW.createWindow width height title Nothing Nothing GLFW.makeContextCurrent $ Just win return win + -- cgit v1.2.3