Graphics Reference
In-Depth Information
4.11
The Projections in OpenGL
In OpenGL one needs to specify the viewing volume. This is done in the way indi-
cated in Figure 4.22. Note that there is no view plane as such and that the z-axis does
not point in the direction one is looking but in the opposite direction. The view volume
is specified by the far clipping plane z =-f and a rectangle [
R
,r] ¥ [b,t] in the near clip-
ping plane z =-n.
The steps in OpenGL are
(1) Convert to camera coordinates.
(2) Map the homogeneous camera coordinates to homogeneous clip space, but
this time one maps into the cube [-1,1] ¥ [-1,1] ¥ [-1,1]. The homogeneous matrix M
that does this is defined by the equation
2
n
Ê
ˆ
0
0
0
Á
Á
Á
Á
Á
Á
Á
˜
˜
˜
˜
˜
˜
˜
r
-
l
n
tb
2
0
0
0
-
nM
=
.
r
r
+
-
l
l
tb
tb
+
-
fn
fn
fn
fn
+
-
-
-
1
2
0
0
-
0
Ë
¯
-
The matrix M is obtained in the same manner as was M hcamÆhclip in Section 4.5. The
call to the function glFrustum (
,r,b,t,n,f) in OpenGL generates the matrix nM.
(3) Project to normalized device coordinates in Euclidean space (division by w).
(4) Transform to the viewport.
R
Figure 4.22.
The OpenGL viewing
volume.
Search WWH ::




Custom Search