This document discusses graphics standards and device independent graphics programming. It describes early graphics APIs like GKS and PHIGS that aimed for portability. OpenGL was successful due to its simple architecture and ability to access hardware acceleration. WebGL is based on OpenGL ES and provides 3D graphics in HTML5 canvas using JavaScript. Different APIs operate at different levels, with lower-level APIs like OpenGL dealing directly with rendering and higher-level APIs handling scene organization.
3. GRAPHICS STANDARD
Goal: portability, standard graphics functions are independent of
programming language, bindings are defined for various
languages
• Early graphics packages
• GKS (Graphical Kernel System)
• PHIGS (Programmer's Hierarchical Interactive Graphics System)
• OpenGL
• Java3D
• Direct3D
• WebGL
2/15/2014
3
• VRML (Virtual Reality Modeling Language)
4. EARLY HISTORY OF APIS
IFIPS (1973) formed two committees to come up with a
standard graphics API
• Graphical Kernel System (GKS)
• 2D but contained good workstation model
• Widely used graphical kernel for CAD and CAM software in
the 1980’s and 1990’s
• Core
• Both 2D and 3D
• GKS adopted as ISO and later ANSI standard (1980s)
GKS not easily extended to 3D (GKS-3D)
• Far behind hardware development
5. PHIGS AND X
Programmers Hierarchical Graphics System (PHIGS)
• At one time considered to be the 3D graphic standard for the
1990’s
• Arose from CAD community
• Database model with retained graphics (structures)
X Window System
• DEC/MIT effort
• Client-server architecture with graphics
PEX combined the two
• Not easy to use (all the defects of each)
6. SGI AND GL
Silicon Graphics (SGI) revolutionized the graphics
workstation by implementing the pipeline in hardware (1982)
To access the system, application programmers used a
library called GL
With GL, it was relatively simple to program three
dimensional interactive applications
7. OPENGL
The success of GL lead to OpenGL (1992), a
platform-independent API that was
• Simple architecture
• Powerful and fast rendering
• Easy to use
• Contains 2 libraries: GL kernel and GLU (OpenGL Utility
Library)
• Close enough to the hardware to get excellent
performance
• 1992-2006 managed by the OpenGL ARB (Architecture
Review Board), now by the khronos group
• No window management: no user interface, no image
processing, no file system support (no image loader)
8. WEBGL
WebGL is based on OpenGL ES 2.0 and provides an API for 3D
graphics.
It uses the HTML5 canvas element and is accessed using
Document Object Model interfaces.
2/15/2014
8
Automatic memory management is provided as part of the
JavaScript language.
10. APIS AND DEVICE INDEPENDENT
GRAPHICS PROGRAMMING
Using APIs makes it possible to create programs that can be
compiled and run on many different graphics platforms.
Most APIs are basically libraries of routines that take care of standard
tasks like rasterization, hidden surface removal, polygon
clipping, projections.
2/15/2014
10
The APIs serve as intermediaries between
the application layer and the hardware
layer. One of their main functions is to
facilitate rendering but they can provide
also higher level as well as lower level
functions.
11. DIFFERENT API LEVELS
Lower level APIs (e.g. the rendering APIs Direct3D and
OpenGL) deal directly with the rendering task.
On the other hand a higher level API like the scene graph API
Java3D takes care of maintaining and organizing information
about the graphic scenes, illumination, and environment
states but needs the help a rendering API to complete the
rendering task.
2/15/2014
11
The relationship between different APIs, the operating
system, and the hardware layer are illustrated in the
following two pages.
12. GRAPHICS STANDARD
API contains functions for creation, manipulation and display of
images
Basic building blocks: primitives and attributes
Geometric transformations
Modeling transformations
Viewing transformations
Structuring/manipulating components hierarchically
Control functions
2/15/2014
12
•
•
•
•
•
•
14. PREPARATION
•
Get a browser that supports it.
• Firefox: just make sure you have version 4 or higher.
• Chrome: all you need to do is install it, or if you’re already using it, just
check whether it’s updated itself to version 10 — this will almost certainly
have happened automatically (it was released in March 2011), but you
can check from the “About Google Chrome” option on the tools menu to
confirm.
• Safari: on Macs, OS X 10.7 has WebGL support, but it’s switched off by
default. To switch it on, enable the developer menu and check the
“Enable WebGL” option. (Thanks to Blah for the heads-up on this one.)
If you’re on Windows, make sure you have the Microsoft DirectX
runtime installed — this is a free download from Microsoft.
•
Once you’ve done that, make sure that you’ve got the very latest versions
of the drivers for your graphics card.
2/15/2014
14
•
15. WEBGL FUNCTION FORMAT
function name
dimensions
Gl.Vertex3f(x,y,z)
x,y,z are floats
belongs to GL library
glVertex3fv(p)
p is a pointer to an array