DOC PREVIEW
UVA CS 445 - OpenGL Transformations

This preview shows page 1-2-3-27-28-29 out of 29 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 29 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1AdminDemoModeling: The CameraSlide 5Introducing OpenGLOpenGL Design GoalsOpenGL: ConventionsSlide 9OpenGL: Simple UseSlide 11Slide 12OpenGL: Perspective ProjectionSlide 14Slide 15OpenGL: LightingSlide 17OpenGL: Specifying ViewpointOpenGL: Specifying GeometryOpenGL: More ExamplesOpenGL: Front/Back RenderingOpenGL: Drawing TrianglesOpenGL: Triangle StripsOpenGL: Modeling TransformsOpenGL: Matrix ManipulationSlide 26OpenGL: Specifying ColorOpenGL: Specifying NormalsMore OpenGLCS 445: Introduction to Computer GraphicsDavid LuebkeUniversity of VirginiaOpenGL TransformationsAdminCall rollForums signup – do it NOW pleaseDemoAnimusicModeling: The CameraFinally: need a model of the virtual camera–Can be very sophisticatedField of view, depth of field, distortion, chromatic aberration…–Interactive graphics (OpenGL):Camera pose: position & orientationCaptured in viewing transform (i.e., modelview matrix)Pinhole camera modelField of viewAspect ratioNear & far clipping planesModeling: The CameraCamera parameters (FOV, etc) are encapsulated in a projection matrix–Homogeneous coordinates  4x4 matrix!–See OpenGL Appendix F for the matrixThe projection matrix premultiplies the viewing matrix, which premultiplies the modeling matrices–Actually, OpenGL lumps viewing and modeling transforms into modelview matrixIntroducing OpenGLRecall the rendering pipeline:–Transform geometry (object  world, world  eye)–Calculate surface lighting–Apply perspective projection (eye screen)–Clip to the view frustum–Perform visible-surface processingImplementing all this is a lot of work (as you’ll find)OpenGL provides a standard implementation –So why study the basics?OpenGL Design GoalsSGI’s design goals for OpenGL:–High-performance (hardware-accelerated) graphics API–Some hardware independence –Natural, terse API with some built-in extensibilityOpenGL has become a standard because:–It doesn’t try to do too muchOnly renders the image, doesn’t manage windows, etc.No high-level animation, modeling, sound (!), etc.–It does enoughUseful rendering effects + high performance–It was promoted by SGI (& Microsoft, half-heartedly), is now promoted/supported by NVIDIA, ATI, etc.–It doesn’t change every year (like DirectX, it’s main competitor)Good and badOpenGL: ConventionsFunctions in OpenGL start with gl–Most functions just gl (e.g., glColor()) –Functions starting with glu are utility functions (e.g., gluLookAt())Note that GLU functions can always be composed entirely from core GL functions–Functions starting with glut are from the GLUT library, built on top of OpenGL and WGL (Windows) or X (Linux) for window management, mouse and keyboard events, etc.Created and distributed as an entirely different libraryOpenGL: ConventionsFunction names indicate argument type and number–Functions ending with f take floats–Functions ending with i take ints–Functions ending with b take bytes–Functions ending with ub take unsigned bytes–Functions that end with v take an array.Examples–glColor3f() takes 3 floats–glColor4fv() takes an array of 4 floatsOpenGL: Simple UseOpen a window and attach OpenGL to itSet projection parameters (e.g., field of view)Setup lighting, if anyMain rendering loop–Set camera pose with gluLookAt() Camera position specified in world coordinates–Render polygons of modelUse modeling matrices to transform vertices in world coordinatesOpenGL: Simple UseOpen a window and attach OpenGL to it–FLTK/GLUT (assignment 0)Set projection parameters (e.g., field of view)Setup lighting, if anyMain rendering loop–Set camera pose with gluLookAt() Camera position specified in world coordinates–Render polygons of modelUse modeling matrices to transform vertices in world coordinatesOpenGL: Simple UseOpen a window and attach OpenGL to itSet projection parameters (e.g., field of view)Setup lighting, if anyMain rendering loop–Set camera pose with gluLookAt() Camera position specified in world coordinates–Render polygons of modelUse modeling matrices to transform vertices in world coordinatesOpenGL: Perspective ProjectionTypically, we use a perspective projection–Distant objects appear smaller than near objects –Vanishing point at center of screen–Defined by a view frustum (draw it)Other projections: orthographic, isometricOpenGL: Perspective ProjectionIn OpenGL: –Projections implemented by projection matrix–gluPerspective() creates a perspective projection matrix:glMatrixMode(GL_PROJECTION);glLoadIdentity(); gluPerspective(vfov, aspect, near, far);Parameters to gluPerspective():–vfov: vertical field of view–aspect: window width/height–near, far: distance to near & far clipping planesMore on these in a bitOpenGL: Simple UseOpen a window and attach OpenGL to itSet projection parameters (e.g., field of view)Setup lighting, if anyMain rendering loop–Set camera pose with gluLookAt() Camera position specified in world coordinates–Render polygons of modelUse modeling matrices to transform vertices in world coordinatesOpenGL: LightingSimplest option: change the current color between polygons or vertices–glColor() sets the current colorOr OpenGL provides a simple lighting model:–Set parameters for light(s)Intensity, position, direction & falloff (if applicable) –Set material parameters to describe how light reflects from the surfaceWon’t go into details now; check the red book if interestedOpenGL: Simple UseOpen a window and attach OpenGL to itSet projection parameters (e.g., field of view)Setup lighting, if anyMain rendering loop–Set camera pose with gluLookAt() Camera position specified in world coordinates–Render polygons of modelUse modeling matrices to transform vertices in world coordinatesOpenGL: Specifying ViewpointglMatrixMode(GL_MODELVIEW);glLoadIdentity();gluLookAt(eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);–eye[XYZ]: camera position in world coordinates–look[XYZ]: a point centered in camera’s view–up[XYZ]: a vector defining the camera’s verticalCreates a matrix that transforms points in world coordinates to camera coordinates–Camera at origin–Looking down -Z axis –Up vector aligned with Y axis (actually Y-Z plane)More on these in a bitOpenGL:


View Full Document

UVA CS 445 - OpenGL Transformations

Documents in this Course
Lighting

Lighting

49 pages

Color

Color

20 pages

Clipping

Clipping

10 pages

Shadows

Shadows

95 pages

Color

Color

37 pages

Radiosity

Radiosity

49 pages

Clipping

Clipping

59 pages

Assign 3

Assign 3

28 pages

Splines

Splines

17 pages

Color

Color

17 pages

Load more
Download OpenGL Transformations
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view OpenGL Transformations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view OpenGL Transformations 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?