Ticket #24 (new defect)

Opened 8 years ago

GLUT mouse coordinates do not appear to match 2D graphics coordinates

Reported by: cgibbard Owned by:
Priority: major Milestone:
Version: Keywords:


Here is a program in which a disc should follow the mouse cursor. Instead, the coordinate scaling is a little different, so they only meet when the mouse is in the centre of the view.

import Control.Applicative
import Data.VectorSpace
import FRP.Reactive
import FRP.Reactive.GLUT.Adapter
import Graphics.FieldTrip
import FRP.Reactive.FieldTrip

main = anim2 myDisk

myDisk ui = motion . pure $ uscale2 (0.1 :: Double) *% udisk
  where motion = liftA2 (*%) (fmap translate2 mouse)
        mouse = fmap (uncurry vector2) (mousePosition ui)
Note: See TracTickets for help on using tickets.