Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]
8
Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]
Transcript of Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]
![Page 1: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/1.jpg)
Glut Coordinate System
Used in keyboard and mouse callbacks
x
y
w
h[window]
![Page 2: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/2.jpg)
Fall 2013 revised 2
Recall OpenGL Rendering Pipeline
stages of vertex transformation
![Page 3: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/3.jpg)
OpenGL NDC (normalized device coordinate)
x
y z
[-1,1]2 × [0,1]depth range
Near (0)
Far (1)
Note: this is a left-hand coordinate system!
![Page 4: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/4.jpg)
Fall 2013 revised 4
Recall OpenGL Rendering Pipeline
stages of vertex transformation
![Page 5: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/5.jpg)
OpenGL Window Coordinates
x
y z
[0,1]2
Near (0)
Far (1)
![Page 6: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/6.jpg)
Use Mouse to Pick 2D World
x
y
xmin xmax
(mx, my)
(x, y)
0
0
minmax
min
w
mx
xx
xx
w
x
Keep all terms positive
in the formula
![Page 7: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/7.jpg)
Use Mouse to Pick 2D World
x
y
ymin
ymax
(mx, my)
(x, y)
h
myh
yy
yy
minmax
min
h
Length ratio: take positive
valuesy
![Page 8: Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]](https://reader035.fdocuments.us/reader035/viewer/2022072015/56649ebf5503460f94bca8a7/html5/thumbnails/8.jpg)
Summary
0
0
minmax
min
w
mx
xx
xx
h
myh
yy
yy
minmax
min
minmaxmin xxw
mxxx
minmaxmin yyh
myhyy