Viewing and Navigating using OpenGL - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Viewing and Navigating using OpenGL

Description:

1. Viewing and Navigating. using. OpenGL. 2. Outside-In Viewing. Object is centered. ... Viewer centered. Observer navigates, looks toward a point. On the sphere. ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 13
Provided by: HughMas6
Category:

less

Transcript and Presenter's Notes

Title: Viewing and Navigating using OpenGL


1
Viewing and Navigatingusing OpenGL
2
Outside-In Viewing
Object is centered. Observer navigates on a
sphere surrounding the object.
3
Inside-Out Viewing
Viewer centered. Observer navigates, looks
toward a point On the sphere. Sphere center
moves with observer.
4
Inside-Out Viewing
Viewer centered. Observer navigates, looks
toward a point On the sphere. Sphere center
moves with observer.
5
Some Spherical Geometry
(x,y,z)
r
q
f
6
Viewing Outside-In
(x,y,z)
gluLookAt(x,y,z,0,0,0,0,1,0)
7
Outside In ViewingSample Code
glLoadIdentity() // start with an identity in
the MODELVIEW transformation x radius
cos(theta) cos(phi) y radius sin(theta) z
-radius cos(theta) sin(phi) gluLookAt(x,y,z
,0,0,0,0,1,0) //multiply viewing component of
transformation glutSolidTeapot(1.0) // draw
what is being looked at (around origin)
8
Viewing Outside In Possible Navigation Key
Mapping
  • GLUT_KEY_LEFT increase phi
  • GLUT_KEY_RIGHT decrease phi
  • GLUT_KEY_UP increase theta
  • GLUT_KEY_DOWN decrease theta
  • GLUT_KEY_PAGE_UP increase radius
  • GLUT_KEY_PAGE_DOWN decrease radius

9
Viewing Inside Out, from Origin
(x,y,z)
gluLookAt(0,0,0,x,y,z,0,1,0)
10
Viewing Inside Out, from Arbitrary Point
(x,y,z)
gluLookAt(x0,y0,z0,x,y,z,0,1,0)
11
Inside Out ViewingSample Code
glLoadIdentity() // start with an identity in
the MODELVIEW transformation x radius
cos(theta) cos(phi) y radius sin(theta) z
-radius cos(theta) sin(phi) gluLookAt(xo,yo
,zo,xox,yoy,zoz,0,1,0) //multiply viewing
transformation glutSolidTeapot(1.0)
12
Viewing Inside Out Possible Navigation Key
Mapping
  • GLUT_KEY_LEFT increase phi (look left)
  • GLUT_KEY_RIGHT decrease phi (look right)
  • GLUT_KEY_UP increase theta (look up)
  • GLUT_KEY_DOWN decrease theta (look down)
  • GLUT_KEY_PAGE_UP walk in direction of view
  • GLUT_KEY_PAGE_DOWN walk away from direction of
    view
Write a Comment
User Comments (0)
About PowerShow.com