Computer Graphics(fall 2009) School of Computer Science University of Seoul
3D Graphics API • OpenGL • Microsoft Direct3D • Implemented in DirectX • Supports MS Windows only (cf: Cedega) • RISpec (RenderMan Interface Specification) • Developed by Pixar Animation Studios • Off-line rendering • Java3D • Scene graph based • Runs on top of OpenGL or Direct3D.
What Do We Need To Render A 3D Scene? • Objects • A Viewer (Camera) • Light Sources • Material Properties(of Objects) [image courtesy of http://www.yourdictionary.com/computer/3-d-graphics]
Simplifications for Interactive Rendering • Objects • Composed of primitives (points, lines, triangles,…) • A Viewer (Camera) • Two types (orthogonal & perspective) • Light Sources • Simple lights (directional and positional) • Gouraud shading model • Material Properties (of Objects) • Phong reflection model
How To Render A Triangle • For each vertex • Transforms it according to the current setting • Computes its color based on the material property and lights • Assembles three vertices into a triangle • Rasterizes the triangle • For each pixel • Assigns its color by interpolating the color of vertices [image courtesy of nVidia]
OpenGL • “…standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics.” (Wikipedia) • Specifies common interface independent of graphics hardware. Hardware vendors need to provide drivers. • Cross-platform
OpenGL (cont’d) • Rendering feature only • No UI, window control, file I/O, etc… • Additional library (e.g., GLUT) required for a complete program. • Immediate mode • State machine • Pipeline architecture • Low level operations only
Hardware Independent • Hardware-specific OpenGL drivers need to be installed. • nVIDIA • AMD (ATI) • Intel • Some features are supported by S/W not H/W.
Cross-platform • Requires a layer between the OpenGL and the window system • GLX: for X Window System • WGL: for Microsoft Windows • AGL (Apple Graphics Library): for MacOS
Rendering Only • Requires additional library for UI, windows management, etc. • Win32 API • GLUT (OpenGL Utility Toolkit) • Qt • wxWidgets
Graphics Pipeline • For better throughput! [image courtesy of Wikipedia]
The Design of OpenGL • Recommended reading: “The Design of the OpenGL Graphics Interface” (1994, Mark Segal and Kurt Akeley)