1 //------------------------------------------------------------------------------
2 // File : camdisplay.cpp
3 //------------------------------------------------------------------------------
4 // GLVU : Copyright 1997 - 2002
5 // The University of North Carolina at Chapel Hill
6 //------------------------------------------------------------------------------
7 // Permission to use, copy, modify, distribute and sell this software and its
8 // documentation for any purpose is hereby granted without fee, provided that
9 // the above copyright notice appear in all copies and that both that copyright
10 // notice and this permission notice appear in supporting documentation.
11 // Binaries may be compiled with this software without any royalties or
14 // The University of North Carolina at Chapel Hill makes no representations
15 // about the suitability of this software for any purpose. It is provided
16 // "as is" without express or implied warranty.
18 //============================================================================
20 //============================================================================
25 //----------------------------------------------------------------------------
26 // OPENGL CAMERA FRUSTUM DRAWING ROUTINES
27 //----------------------------------------------------------------------------
28 void Camera::Display() const
30 // CALC EIGHT CORNERS OF FRUSTUM (NEAR PTS AND FAR PTS)
35 // DRAW THE FRUSTUM IN WIREFRAME
36 glBegin(GL_LINE_LOOP); // TOP FACE
37 glVertex3fv(&(V[4].x)); glVertex3fv(&(V[5].x));
38 glVertex3fv(&(V[1].x)); glVertex3fv(&(V[0].x));
40 glBegin(GL_LINE_LOOP); // BOTTOM FACE
41 glVertex3fv(&(V[3].x)); glVertex3fv(&(V[2].x));
42 glVertex3fv(&(V[6].x)); glVertex3fv(&(V[7].x));
44 glBegin(GL_LINE_LOOP); // LEFT FACE
45 glVertex3fv(&(V[1].x)); glVertex3fv(&(V[5].x));
46 glVertex3fv(&(V[6].x)); glVertex3fv(&(V[2].x));
48 glBegin(GL_LINE_LOOP); // RIGHT FACE
49 glVertex3fv(&(V[0].x)); glVertex3fv(&(V[3].x));
50 glVertex3fv(&(V[7].x)); glVertex3fv(&(V[4].x));
52 glBegin(GL_LINE_LOOP); // NEAR FACE
53 glVertex3fv(&(V[1].x)); glVertex3fv(&(V[2].x));
54 glVertex3fv(&(V[3].x)); glVertex3fv(&(V[0].x));
56 glBegin(GL_LINE_LOOP); // FAR FACE
57 glVertex3fv(&(V[4].x)); glVertex3fv(&(V[7].x));
58 glVertex3fv(&(V[6].x)); glVertex3fv(&(V[5].x));
61 // DRAW PROJECTOR LINES FROM EYE TO CORNERS OF VIEWPLANE WINDOW
63 glVertex3fv(&(Orig.x)); glVertex3fv(&(V[1].x));
64 glVertex3fv(&(Orig.x)); glVertex3fv(&(V[2].x));
65 glVertex3fv(&(Orig.x)); glVertex3fv(&(V[3].x));
66 glVertex3fv(&(Orig.x)); glVertex3fv(&(V[0].x));
70 void Camera::DisplayInGreen() const
72 //draws the camera in unlit green lines, then restores the GL state
73 glPushAttrib(GL_LIGHTING_BIT);
74 glDisable(GL_LIGHTING);
75 glPushAttrib(GL_LINE_BIT);