DOC PREVIEW
UVA CS 445 - Graphics Systems and OpenGL

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 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 40 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 40 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 40 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 40 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 40 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 40 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 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Graphics Systems and OpenGLCool Video GamesRendering 3D ScenesThe Rendering PipelineRendering: TransformationsThe Rendering Pipeline: 3-DPowerPoint PresentationSlide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Introducing OpenGLSlide 17OpenGL Design GoalsOpenGL: ConventionsSlide 20Slide 21OpenGL Matrix StacksSlide 23Slide 24Slide 25OpenGL: BasicsOpenGL: main()main(): Open a windowmain(): Setup Camera Parametersmain(): Register Callback Functionsmain(): Initiate main rendering loopCallback: Display_Func()Slide 33Slide 34Slide 35draw_paddle(void)Callback: keyboard_func()Callback: move_ball()Callback: mouseFunc, motionFuncSlide 40Graphics Systemsand OpenGLCS 445/645Introduction to Computer Graphics2Cool Video Gameshttp://www.stanford.edu/~mazzella/university/cs248/pacman/pacman.htmhttp://www.liquid.se/pong.html3Rendering 3D ScenesTransformIlluminateTransformClipProjectRasterizeModel & CameraModel & CameraParametersParametersRendering PipelineRendering PipelineFramebufferFramebufferDisplayDisplay4The Rendering PipelineTransformIlluminateTransformClipProjectRasterizeModel & CameraModel & CameraParametersParametersRendering PipelineRendering PipelineFramebufferFramebufferDisplayDisplay5Rendering: TransformationsSo far, discussion has been in screen spaceBut model is stored in model space(a.k.a. object space or world space)Three sets of geometric transformations:–Modeling transforms–Viewing transforms–Projection transforms6The Rendering Pipeline: 3-DResult:Result:• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem• Vertices shaded according to lighting modelVertices shaded according to lighting model• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped verticesScene graphObject geometryLightingCalculationsClippingModelingTransformsViewingTransformProjectionTransform7The Rendering Pipeline: 3-DModelingTransformsScene graphObject geometryLightingCalculationsViewingTransformClippingProjectionTransformResult:Result:• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem8Rendering: TransformationsModeling transforms–Size, place, scale, and rotate objects and parts of the model w.r.t. each other–Object coordinates  world coordinatesZXYXZY9ModelingTransformsScene graphObject geometryLightingCalculationsViewingTransformClippingProjectionTransformResult:Result:• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystemThe Rendering Pipeline: 3-D10Rendering: TransformationsViewing transform–Rotate & translate the world to lie directly in front of the cameraTypically place camera at originTypically looking down -Z axis–World coordinates  view coordinates11ModelingTransformsScene graphObject geometryLightingCalculationsViewingTransformClippingProjectionTransformResult:Result:• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped verticesThe Rendering Pipeline: 3-D12Rendering: TransformationsProjection transform–Apply perspective foreshorteningDistant = small: the pinhole camera model–View coordinates  screen coordinates13Perspective CameraOrthographic CameraRendering: Transformations14Rendering: TransformationsAll these transformations involve shifting coordinate systems (i.e., basis sets)That’s what matrices do…Represent coordinates as vectors, transforms as matricesMultiply matrices = concatenate transforms!YXYXcossinsincos15Rendering: TransformationsExample: Rotate point [1,0]T by 90 degrees CCW (Counter-clockwise)10''010110''01)90cos()90sin()90sin()90cos(''yxyxyxxy(1,0)x(0,1)y16Introducing OpenGLmid-level, device-independent, portable graphics subroutine packagedeveloped primarily by SGI2D/3D graphics, lower-level primitives (polygons)does not include low-level I/O managementbasis for higher-level libraries/toolkits17Introducing OpenGLRecall the rendering pipeline:–Transform geometry (object  world, world eye)–Apply perspective projection (eye screen)–Clip to the view frustum–Perform visible-surface processing (Z-buffer)–Calculate surface lightingImplementing all this is a lot of work OpenGL provides a standard implementation –So why study the basics?18OpenGL 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 is promoted by SGI (& Microsoft, half-heartedly)19OpenGL: ConventionsFunctions in OpenGL start with gl–Most functions just gl (e.g., glColor()) –Functions starting with glu are utility functions (e.g., gluLookAt())–Functions starting with glx are for interfacing with the X Windows system (e.g., in gfx.c)20OpenGL: 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 floats21OpenGL: ConventionsVariables written in CAPITAL letters–Example: GLUT_SINGLE, GLUT_RGB–usually constants–use the bitwise or command (x | y) to combine constants22OpenGL Matrix StacksOpenGL basically just renders vertices–Vertices can be grouped to form polygons–Polygons can be grouped to form shapes (solids)Each glVertex rendered by OpenGL is transformed by the top matrix on the MODELVIEW matrix stack–As


View Full Document

UVA CS 445 - Graphics Systems and OpenGL

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 Graphics Systems and OpenGL
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 Graphics Systems and OpenGL 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 Graphics Systems and OpenGL 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?