OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

OpenGL Course Notes Chapter 3: Viewing Jim Mims, Spring 2009.
02/17/05CISC640/440 OpenGL Tutorial1 OpenGL Tutorial CISC 640/440 Computer Graphics TA: Qi Li/Mani Thomas
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
The View Frustum and the Camera Lecture 19 Fri, Oct 10, 2003.
OpenGL Basics Donghui Han. Assignment Grading Visual Studio Glut Files of four types needed: – Source code:.cpp,.h – Executable file:.exe (build in release.
Based on slides created by Edward Angel
Viewing and Transformation
Viewing and Projections
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
CS 352: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
OpenGL and Projections
OpenGL (II). How to Draw a 3-D object on Screen?
CS 4731: Computer Graphics Lecture 11: 3D Viewing Emmanuel Agu.
Modeling and Viewing Modeling
Noggin (BYU Students, SIGGRAPH 2006). Introduction to OpenGL Programming Rick Skarbez, Instructor COMP 575 September 11, 2007.
Computer Graphics 3D Transformations. 3D Translation Remembering 2D transformations -> 3x3 matrices, take a wild guess what happens to 3D transformations.
Development of Interactive 3D Virtual World Applications
Introduction to 3D viewing 3D is just like taking a photograph!
2002 by Jim X. Chen: 2D viewing –Window –Viewport 3D viewing –Projection methods and viewing volumes –Normalization –Clipping.
3D coordinate systems X Y Z Right-Hand Coordinate System X Y Z Left-Hand Coordinate System OpenGL uses this! Direct3D uses this!
GLWidget Description Jason Goffeney 3/8/2006. GLWidget The GLWidget class extends the Qt QGLWidget. The QGLWidget is a Qt Widget that happens to have.
Computer Graphics, KKU. Lecture 131 Transformation and Viewing in OpenGL.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Geometric transformations The Pipeline
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
Introduction to OpenGL 1. 2 OpenGL A Graphics rendering API introduced in 1992 by Silicon Graphics Inc Provide the low-level functions to access graphics.
Stages of Vertex Transformation To specify viewing, modeling, and projection transformations, you construct a 4 × 4 matrix M, which is then multiplied.
Computer Graphics Bing-Yu Chen National Taiwan University.
Computer Graphics I, Fall 2010 Computer Viewing.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
CS 445 / 645 Introduction to Computer Graphics Lecture 10 Camera Models Lecture 10 Camera Models.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
CGGM Lab. Tan-Chi Ho 2001 Viewing and Transformation.
Projections. Viewports Windows can have separate viewports void glViewport(GLint x, GLint y, GLsizei width, GLsizei height ) x, y - Specify the lower.
Viewing Korea Univ. Computer Graphics Lab. Hong, Jin Kyung.
Introduction to Computer Graphics: Viewing Transformations Rama C
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
Chap 3 Viewing and Transformation
Honours Graphics 2008 Session 3. Today’s focus Perspective and orthogonal projection Quaternions Graphics camera.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
Implement of transformation,projection, viewing Hanyang University Jungsik Park.
OpenGL LAB III.
Computer Graphics Lecture 41 Viewing Using OpenGL Taqdees A. Siddiqi
CS 490: Computer Graphics Chapter 5: Viewing. Interactive Computer GraphicsChapter Overview Specifying the viewpoint Specifying the projection Types.
CSC Graphics Programming
Courtesy of Drs. Carol O’Sullivan / Yann Morvan Trinity College Dublin
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
CSCE 441 Computer Graphics 3-D Viewing
Reference1. [OpenGL course slides by Rasmus Stenholt]
“Computer Science is no more about computers than astronomy is about telescopes.” Professor Edsger Dijkstra.
Projection v VP u VPN n.
Advanced Graphics Algorithms Ying Zhu Georgia State University
Lecture 08 and 09 View & Projection
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University View & Projection.
Computer Graphics, KKU. Lecture 13
Computer Graphics (Spring 2003)
Type of View Perspective View COP(Center of Plane) Diminution of size
Computer Graphics 3Practical Lesson
Chapter 3 Viewing.
Projection v VP u VPN n.
Presentation transcript:

OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide

Learning Objectives Know how to view a geometric model in any orientation by transforming it in three- dimensional space Know how to control the location in three- dimensional space from which the model is viewed Understand how to manipulate the appropriate matrix stacks that control model transformation for viewing and project the model onto the screen

The Camera Analogy

The Vertex Transformations

General Transformation Commands glMatrixMode() Specifies whether the modelview, projection, or texture matrix will be modified, using the argument GL_MODELVIEW, GL_PROJECTION, or GL_TEXTURE for mode. Subsequent transformation commands affect the specified matrix. Note that only one matrix can be modified at a time. By default, the modelview matrix is the one that's modifiable, and all three matrices contain the identity matrix. void glLoadIdentity(void); Sets the currently modifiable matrix to the 4 × 4 identity matrix.

Load and Mult Matrices void glLoadMatrix{fd}(const TYPE *m); Sets the sixteen values of the current matrix to those specified by m. void glMultMatrix{fd}(const TYPE *m); Multiplies the matrix specified by the sixteen values pointed to by m by the current matrix and stores the result as the current matrix.

Mathematical and Programming Notes OpenGL uses column instead of row vectors Let C be the current matrix and call glMultMatrix*(M). After multiplication, the final matrix is always CM. Matrices are defined like this (use float m[16]);

OpenGL uses a Transposed Version of the Matrices We Covered glTranslate*(x, y, z) glScale*(x, y, z)

Rotations

Perspective Projection glFrustum(l, r, b, t, n, f)

gluPerspective void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble near, GLdouble far); Creates a matrix for a symmetric perspective-view frustum and multiplies the current matrix by it. fovy is the angle of the field of view in the x-z plane; its value must be in the range [0.0,180.0]. aspect is the aspect ratio of the frustum, its width divided by its height. near and far values the distances between the viewpoint and the clipping planes, along the negative z-axis. They should always be positive

Orthographic Projection glOrtho(l, r, b, t, n, f )

gluLookAt void gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz); Defines a viewing matrix and multiplies it to the right of the current matrix. The desired viewpoint is specified by eyex, eyey, and eyez. The centerx, centery, and centerz arguments specify any point along the desired line of sight, but typically they're some point in the center of the scene being looked at. The upx, upy, and upz arguments indicate which direction is up (that is, the direction from the bottom to the top of the viewing volume).

Viewport Transformation void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); Defines a pixel rectangle in the window into which the final image is mapped. The (x, y) parameter specifies the lower-left corner of the viewport, and width and height are the size of the viewport rectangle. By default, the initial viewport values are (0, 0, winWidth, winHeight), where winWidth and winHeight are the size of the window.

Learning Objectives Know how to view a geometric model in any orientation by transforming it in three- dimensional space Know how to control the location in three- dimensional space from which the model is viewed Understand how to manipulate the appropriate matrix stacks that control model transformation for viewing and project the model onto the screen