opengl conclusions opengl programming and reference guides, other sources csci 6360/4360

12
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

Upload: magdalene-chase

Post on 02-Jan-2016

250 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL ConclusionsOpenGL Programming and Reference Guides, other

sources

CSCI 6360/4360

Page 2: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

• Putting the OpenGL pieces together

• Recall, this all a “survival guide” …

• OpenGL “post-view”– Coordinate systems in viewing– OpenGL Transformations– Transformations between coordinate systems– OpenGL geometry and pixel paths

• OpenGL pipeline– Vertices primitives fragments pixels– Programmer access to all– Pieces in context of the whole

Overview

Page 3: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

Coordinate Systems in Viewing • Coordinate Systems in the Graphics Pipeline

– OCS – object coordinate system – WCS – world coordinate system – VCS – viewing coordinate system – CCS – clipping coordinate system – NDCS - normalized device coordinate system – DCS – device coordinate system

• Images are formed on the image plane

Page 4: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL Transformations• Series of “viewing transformations”

– transforms a point (its coordinates) from world space to eye space– Set these transformation matrices as part of OpenGL programming– Each transformation operates on different spaces and coordinates

• Model – View – Projection – Perspective Divide - Viewport

• From “red book”:

Page 5: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

Transform. between Coordinate Sys.

• Transformations– Between coordinate systems

• Model– OCS – WCS

• View– WCS – V(E)CS

• Projection– VCS – CCS

• Perspective divide– CCS - NDCS

• Viewport– NDCS - DCS

Page 6: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

Texture Mapping and OpenGL Pipeline

• Many techniques rely on direct interactions with frame buffer– Texture mapping, antialiasing, compositing, alpha blending, …

• OpenGL allows API access to both “geometry path” and “pixel path”– Bitmaps, pixel to rasterization and texture mapping to fragment processing

• Images and geometry flow through separate pipelines that join during rasterization and fragment processing

– “complex” textures do not affect geometric complexity– Texture application is done “at last minute”

Geometry PathGeometry Path

Pixel Path

Page 7: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL Pipeline

• OpenGL pipeline “big picture” – Different coordinate systems – Transformations

• Figure from Blue Book– http://www.opengl.org/documentation/blue_book– http://www.glprogramming.com/blue/ch02.html

• Vertices – describe shape of objects

• Primitives – polygons, lines, pixels

• Fragments – clipped, etc., primitives

• Pixels – elements of frame buffer

• Three parallel set of operations on– Vertices, color, textures

Page 8: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL Pipeline - Vertices

• Vertices– Location (x,y,z) and color (rgba)– Normal used for lighting, etc.

• Vertex position transformed by model-view matrix

– Object loc. and camera view

• Lighting model applied to vertex color (using vertex loc.)

• Textures– Recall, different (sub)pipeline– OpenGL handles the mapping

of textures to polygons• Texture coordinates

• Vertex raster position– Where in frame buffer located

Page 9: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL Pipeline - Primitives

• Primitive Assembly– Assembly of verts. into primitives

• Polygons, line segments, points

• Conversion to pixel fragments– Clipped – Converted to wind. coords.

• App. Clipping of primitives

• Projection transformation

• Clip to view volume – Transform to clip coordinates

• Perspective divide – to normalized device coordinates– Map to viewport and window

• Direct pixel operations possible

Page 10: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL Pipeline-Fragments, Pixels

• Fragment– Point and its color, texture,

depth data are a fragment

• Rasterization – Converts clipped primitives to

2-d image (pixels)– Each point of image contains

color, texture, depth data

• Fragments operations (e.g., xor) can be performed

• Final texture application using “images” stored in memory based on fragment values

• Frame buffer– Image scanned out

Page 11: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

OpenGL Pipeline

• … and that’s the “big picture!

Page 12: OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360

End