Lecture18-OpenGL-Misc

# Lecture18-OpenGL-Misc - CS 455 Computer Graphics More...

This preview shows pages 1–12. Sign up to view the full content.

CS 455 – Computer Graphics More OpenGL

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Matrix Operations   • OpenGL has 4 matrices it uses: GL_MODELVIEW - contains the composite modeling and viewing matrices GL_PROJECTION - contains a matrix for the projection transformation GL_TEXTURE - used for performing operations on the texture (stretching, moving,  rotating, etc.) GL_COLOR - used for color space conversions Make sure the appropriate matrix is current when you do modeling, viewing, or projections
Setting the Current Matrix   void glMatrixMode(Glenum mode); sets the current matrix to be mode mode is GL_MODELVIEW, GL_PROJECTION , GL_TEXTURE , or GL_COLOR

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Multiplying the Current Matrix   void glMultMatrix{fd}(TYPE *m) Postmultiplies the current matrix by m , which is of TYPE GLfloat or GLdouble

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Transformations   • Translation: void glTranslate{fd}( TYPE dx, TYPE dy, TYPE dz) TYPE is GLfloat or GLdouble The translation is applied to the current matrix – make sure the appropriate matrix is current, e.g., glMatrixMode(GL_MODELVIEW); glTranslate(0.3, 0.2, 1.5); Distances are in world coordinates
Transformations   • Rotation: void glRotate{fd}(TYPE angle, TYPE dx, TYPE dy, TYPE dz) rotates angle about the axis given by (dx, dy, dz) and the origin TYPE is GLfloat or GLdouble

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Transformations   • Scale: void glScale{fd}( TYPE sx, TYPE sy, TYPE sz) scales about the origin by (sx, sy, sz) TYPE is GLfloat or GLdouble
Viewing - parallel Setting an orthographic view glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) produces a parallel projection with the clipping volume being [left, right]  in the x direction,  [bottom, top]  in the  y direction, and  [zNear, zFar]  in the z direction • Only objects falling in this region will be drawn • make sure you call  glMatrixMode (GL_PROJECTION); and usually   glLoadIdentity(); prior to calling glOrtho()

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Viewing - perspective Setting a perspective view gluPerspective (GLdouble fovy, GLdouble aspect GLdouble near, GLdouble far) fovy  is the angle of the field of view in the x-z plane,  and must be between 0 and 180. aspect  is the aspect ratio (width / height)  near  is the distance from the viewpoint to the near  clipping plane (always positive)  far  is the distance from the viewpoint to the far  clipping plane (always positive)
Camera Set-Up   • Used to specify camera position and parameters void gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble atx, GLdouble aty, GLdouble atz, GLdouble upx, GLdouble upy, GLdouble upz) The eye point (eyex, eyey, eyez) is the lookFrom point The at point (atx, aty, atz)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/02/2012 for the course C S 455 taught by Professor Jones,m during the Winter '08 term at BYU.

### Page1 / 41

Lecture18-OpenGL-Misc - CS 455 Computer Graphics More...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online