Computer Graphics Software Lec 02 PDF
Document Details
Uploaded by StellarConstructivism3280
Suez Canal University
Dr Adel Khaled
Tags
Summary
This document provides lecture notes on computer graphics software, covering topics such as coordinate representations, graphics functions, software standards, and introduction to OpenGL. It also includes examples of special-purpose packages like Photoshop and AutoCAD.
Full Transcript
Computer Graphics Software Lec 02 Dr Adel Khaled Outlines Coordinate Representations Graphics Functions Software Standards Other Graphics Packages Introduction to OpenGL Summary Introduction There are two broad classif...
Computer Graphics Software Lec 02 Dr Adel Khaled Outlines Coordinate Representations Graphics Functions Software Standards Other Graphics Packages Introduction to OpenGL Summary Introduction There are two broad classifications for computer-graphics software: special- purpose packages and general programming packages. Special-purpose packages are designed for nonprogrammers who want to generate pictures, graphs, or charts in some application area without worrying about the graphics procedures that might be needed to produce such displays. The interface to a special-purpose package is typically a set of menus that allow users to communicate with the programs in their own terms. Examples of such applications include artists' painting programs and various architectural, business, medical, and engineering CAD systems. Introduction Introduction Introduction Introduction Autodesk Maya is a powerful 3D computer graphics application used for creating interactive 3D applications, including video games, animated films, TV series, and visual effects. Introduction Blender has a great add-on called CAD Sketcher that brings CAD-like precision modeling to Blender. This free and open-source add-on allows you to create 2D/2D sketches defined by geometric constraints such as tangents, distances, and angles. Introduction POV-Ray, or the Persistence of Vision Raytracer, is a powerful tool for creating high-quality, three-dimensional graphics. Introduction General programming package provides a library of graphics functions that can be used in a programming language such as C, C++, Java, or Fortran. Coding to Draw Basic functions in a typical graphics library include those for specifying picture components (straight lines, polygons, spheres, and other objects), setting color values, selecting views of a scene, and applying rotations or other transformations. Some examples of general graphics programming packages are GL (Graphics Library), OpenGL, VRML (Virtual-Reality Modeling Language), Java 2D, and Java 3D. A set of graphics functions is often called a computer-graphics application programming interface (CG API) because the library provides a software interface between programming language(such as C++) and the hardware. So, when we write an application program in C++, the graphics routines allow us to construct and display a picture on an output device. Coordinate Representations (pipeline) To generate a picture using a programming package, we first need to give the geometric descriptions of the objects that are to be displayed. These descriptions determine the locations and shapes of the objects on your screen. For example, a box is specified by the positions of its corners (vertices), and a sphere is defined by its center position and radius. general graphics packages require geometric descriptions to be specified in a standard, right-handed, Cartesian- coordinate reference frame. If coordinate values for a picture are given in some other reference frame (spherical, hyperbolic, etc.), they must be converted to Cartesian coordinates before they can be input to the graphics package. Coordinate Representations In general, several different Cartesian reference frames are used in the process of constructing and displaying a scene. First, we can define the shapes of individual objects, such as trees or furniture, within a separate reference frame for each object. These reference frames are called modeling coordinates, or sometimes local coordinates (in your program or simply your code) or master coordinates. Coordinate Representations Once the individual object shapes have been specified, we can construct (“model”) a scene by placing the objects into appropriate locations within a scene reference frame called world coordinates. This step involves the transformation of the individual modeling-coordinate frames to specified positions and orientations within the world-coordinate frame. As an example, we could construct a bicycle by defining each of its parts (wheels, frame, seat, handlebars, gears, chain, pedals) in a separate modeling- coordinate frame. Then, the component parts are fitted together in world coordinates. Coordinate Representations After all parts of a scene have been specified, the overall world- coordinate description is processed through various routines onto one or more output-device reference frames for display. This process is called the viewing pipeline. World- coordinate positions are first converted to viewing coordinates corresponding to the view we want of a scene, based on the position and orientation of a hypothetical camera. Then object locations are transformed to a two-dimensional (2D) projection of the scene, which corresponds to what we will see on the output device. The scene is then stored in normalized coordinates, where each coordinate value is in the range from −1 to 1 or in the range from 0 to 1, depending on the system. Coordinate Representations Normalized coordinates are also referred to as normalized device coordinates, since using this representation makes a graphics package independent of the coordinate range for any specific output device. We also need to identify visible surfaces and eliminate picture parts outside the bounds for the view we want to show on the display device. Finally, the picture is scan-converted into the refresh buffer of a raster system for display. The coordinate systems for display devices are generally called device coordinates, or screen coordinates in the case of a video monitor. Coordinate Representations Graphics Functions A general-purpose graphics package provides users with a variety of functions for creating and manipulating pictures. These routines can be broadly classified according to whether they deal with graphics output, input, attributes, transformations, viewing, subdividing pictures, or general control. Graphics output primitives. They include character strings and geometric entities, such as points, straight lines, curved lines, filled color areas (usually polygons), and shapes defined with arrays of color points. Chapter 3. In addition, some graphics packages provide functions for displaying more complex shapes such as spheres, cones, and cylinders. Routines for generating output primitives provide the basic tools for constructing pictures. Graphics Functions Attributes are properties of the output primitives; that is, an attribute describes how a particular primitive is to be displayed. This includes color specifications, line styles, text styles, and area-filling patterns Geometric transformations. We can change the size, position, or orientation of an object within a scene using. Some graphics packages provide an additional set of functions for performing modeling transformations, which are used to construct a scene where individual object descriptions are given in local coordinates. Such packages usually provide a mechanism for describing complex objects (such as an electrical circuit or a bicycle) with a tree (hierarchical) structure. Other packages simply provide the geometric-transformation routines and leave modeling details to the programmer. Graphics Functions Viewing transformations are used to select a view of the scene, the type of projection to be used, and the location on a video monitor where the view is to be displayed. Other routines are available for managing the screen display area by specifying its position, size, and structure. For three-dimensional scenes, visible objects are identified, and the lighting conditions are applied. Input functions are used to control and process the data flow from these interactive devices. Interactive graphics applications use various kinds of input devices, including a mouse, a tablet, and a joystick. A graphics package contains a number of housekeeping tasks, such as clearing a screen display area to a selected color and initializing parameters. We can lump the functions for carrying out these chores under the heading control operations. Software Standards The primary goal of standardized graphics software is portability. When packages are designed with standard graphics functions, software can be moved easily from one hardware system to another and used in different implementations and applications. Without standards, programs designed for one hardware system often cannot be transferred to another system without extensive rewriting of the programs. Software Standards After considerable effort, this work on standards led to the development of the Graphical Kernel System (GKS) in 1984. This system was adopted as the first graphics software standard by the International Standards Organization (ISO) and by various national standards organizations, including the American National Standards Institute (ANSI). Although GKS was originally designed as a two-dimensional graphics package, a three- dimensional GKS extension was soon developed. Software Standards The second software standard to be developed and approved by the standards organizations was Programmer’s Hierarchical Interactive Graphics System (PHIGS), which is an extension of GKS. Increased capabilities for hierarchical object modeling, color specifications, surface rendering, and picture manipulations are provided in PHIGS. Subsequently, an extension of PHIGS, called PHIGS+, was developed to provide three- dimensional surface- rendering capabilities not available in PHIGS. As the GKS and PHIGS packages were being developed, the graphics work- stations from Silicon Graphics, Inc. (SGI), became increasingly popular. These workstations came with a set of routines called GL (Graphics Library), which very soon became a widely used package in the graphics community. Software Standards OpenGL was developed as a hardware- independent version of GL in the early 1990s. This graphics package is now maintained and updated by the OpenGL Architecture Review Board The OpenGL library is specifically designed for efficient processing of three- dimensional applications, but it can also handle two-dimensional scene descriptions as a special case of three dimensions where all the z coordinate values are Graphics functions in any package are typically defined as a set of specifications independent of any programming language. Software Standards A language binding is then defined for a particular high-level programming language. This binding gives the syntax for accessing the various graphics functions from that language. Each language binding is defined to make best use of the corresponding language capabilities and to handle various syntax issues, such as data types, parameter passing, and errors. Specifications for implementing a graphics package in a particular language are set by the ISO. The OpenGL bindings for the C and C++ languages are the same. Other OpenGL bindings are also available, such as those for Java and Python. Introduction to OpenGL Basic OpenGL Syntax Function names in the OpenGL basic library (also called the OpenGL core library) are prefixed with gl, and each component word within a function name has its first letter capitalized. The following examples illustrate this naming convention: glBegin, glClear, glCopyPixels, glPolygonMode Basic Libraries started with lowercase gl Introduction to OpenGL glBegin — delimit the vertices of a primitive or a group of like primitives glClear : Bitwise OR of masks that indicate the buffers to be cleared. The three masks are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. glCopyPixels — copy pixels in the frame buffer. glPolygonMode: is an OpenGL function that controls how polygons are interpreted and rendered during rasterization. Rasterization is the process of converting geometric data (like polygons) into pixels or fragments on the screen. Introduction to OpenGL Basic OpenGL Syntax Certain functions require that one (or more) of their arguments be assigned a symbolic constant specifying, for instance, a parameter name, a value for a parameter, or a particular mode. All such constants begin with the uppercase letters GL. In addition, component words within a constant name are written in capital letters, and the underscore ( _ ) is used as a separator between all component words in the name. The following are a few examples of the several hundred symbolic constants available for use with OpenGL functions: GL_2D, GL_RGB, GL_CCW, GL_POLYGON GL_AMBIENT_AND_DIFFUSE Introduction to OpenGL Basic OpenGL Syntax The OpenGL functions also expect specific data types. For example, an OpenGL function parameter might expect a value that is specified as a 32-bit integer. But the size of an integer specification can be different on different machines. To indicate a specific data type, OpenGL uses special built-in, data-type names, such as GLbyte, GLshort, GLint, GLfloat, GLdouble, GLboolean Each data-type name begins with the capital letters GL, and the remainder of the name is a standard data- type designation written in lowercase letters Introduction to OpenGL Introduction to OpenGL ptrbits is the bitdepth of a CPU pointer address. Therefore, these types must be large enough to store a pointer: sizeof(void*). Introduction to OpenGL Related Libraries In addition to the OpenGL basic (core) library, there are a number of associated libraries for handling special operations. The OpenGL Utility (GLU) provides routines for setting up viewing and projection matrices, describing complex objects with line and polygon approximations, displaying quadrics and B-splines using linear approximations, processing the surface-rendering operations, and other complex tasks. Built on-top of the core OpenGL to provide important utilities (such as setting camera view and projection). Every OpenGL implementation includes the GLU library, and all GLU function names start with the prefix glu. a B-spline or basis spline is a spline function that has minimal support with respect to a given degree, smoothness, and domain partition. Introduction to OpenGL Related Libraries To create a graphics display using OpenGL, we first need to set up a display window on our video screen. This is simply the rectangular area of the screen in which our picture will be displayed. We cannot create the display window directly with the basic OpenGL functions since this library contains only device- independent graphics functions, and window-management operations depend on the computer we are using. However, there are several window-system libraries that support OpenGL functions for a variety of machines. Introduction to OpenGL Related Libraries The OpenGL Extension to the X Window System (GLX) provides a set of routines that are prefixed with the letters glX. Apple systems can use the Apple GL (AGL) interface for window-management operations. Function names for this library are prefixed with agl. For Microsoft Windows systems, the WGL routines provide a Windows-to-OpenGL interface. These routines are prefixed with the letters wgl. The Presentation Manager to OpenGL (PGL) is an interface for the IBM OS/2, which uses the prefix pgl for the library routines. The OpenGL Utility Toolkit (GLUT) provides a library of functions for interacting with any screen- windowing system. The GLUT library functions are prefixed with glut, and this library also contains methods for describing and rendering quadric curves and surfaces. Introduction to OpenGL Related Libraries Since GLUT is an interface to other device-specific window systems, we can use it so that our programs will be device-independent. Information regarding the latest version of GLUT and download procedures for the source code are available at the following web site:. http://www.opengl.org/resources/libraries/glut/ Introduction to OpenGL Related Libraries OpenGL Extension Wrangler Library (GLEW): "GLEW is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. Source and pre-build binary available at http://glew.sourceforge.net/. A standalone utility called "glewinfo.exe" (under the "bin" directory) can be used to produce the list of OpenGL functions supported by your graphics system. Introduction to OpenGL Header Files In all of our graphics programs, we will need to include the header file for the OpenGL core library. For most applications we will also need GLU/Glut, and on many systems we will need to include the header file for the window system. For instance, with Microsoft Windows, the header file that accesses the WGL routines is windows.h. This header file must be listed before the OpenGL and GLU header files because it contains macros needed by the Microsoft Windows version of the OpenGL libraries. So the source file in this case would begin with #include #include #include Introduction to OpenGL Header Files However, if we use GLUT to handle the window-managing operations, we do not need to include gl.h and glu.h because GLUT ensures that these will be included correctly. Thus, we can replace the header files for OpenGL and GLU with #include or #include. For instance, on Apple OS X systems, the header file inclusion statement would be #include Introduction to OpenGL Header Files In addition, we will often need to include header files that are required by the C++ code. For example, #include #include #include With the ISO/ANSI standard for C++, these header files are called cstdio, cstdlib, and cmath. stdio This library uses what are called streams to operate with physical devices such as keyboards, printers, terminals or with any other type of files supported by the system. stdlib This header defines several general purpose functions, including dynamic memory management, random number generation, communication with the environment, integer arithmetics, searching, sorting and converting. Introduction to OpenGL Display-Window Management Using GLUT To get started, we can consider a simplified, minimal number of operations for displaying a picture. Since we are using the OpenGL Utility Toolkit, our first step is to initialize GLUT. This initialization function could also process any command- line arguments, but we will not need to use these parameters for our first example programs. We perform the GLUT initialization with the statement glutInit (&argc, argv); Introduction to OpenGL Display-Window Management Using GLUT glutInit is used to initialize the GLUT library. Usage void glutInit(int *argcp, char **argv); argcp A pointer to the program's unmodified argc variable from main. Upon return, the value pointed to by argcp will be updated, because glutInit extracts any command line options intended for the GLUT library. argv The program's unmodified argv variable from main. Like argcp, the data for argv will be updated because glutInit extracts any command line options understood by the GLUT library. Introduction to OpenGL Description glutInit will initialize the GLUT library and negotiate a session with the window system. During this process, glutInit may cause the termination of the GLUT program with an error message to the user if GLUT cannot be properly initialized. Examples of this situation include the failure to connect to the window system, the lack of window system support for OpenGL, and invalid command line options. glutInit also processes command line options, but the specific options parse are window system dependent. Introduction to OpenGL X Implementation Notes The X Window System specific options parsed by glutInit are as follows: -display DISPLAY Specify the X server to connect to. If not specified, the value of the DISPLAY environment variable is used. -geometry W x H + X + Y Determines where window's should be created on the screen. The parameter following -geometry should be formatted as a standard X geometry specification. The effect of using this option is to change the GLUT initial size and initial position the same as if glutInitWindowSize or glutInitWindowPosition were called directly. Introduction to OpenGL -iconic Requests all top-level windows be created in an iconic state. -indirect Force the use of indirect OpenGL rendering contexts. -direct Force the use of direct OpenGL rendering contexts (not all GLX implementations support direct rendering contexts). A fatal error is generated if direct rendering is not supported by the OpenGL implementation. If neither -indirect or -direct are used to force a particular behavior, GLUT will attempt to use direct rendering if possible and otherwise fallback to indirect rendering. -gldebug After processing callbacks and/or events, check if there are any OpenGL errors by calling glGetError. If an error is reported, print out a warning by looking up the error code with gluErrorString. Using this option is helpful in detecting OpenGL run-time errors. -sync Enable synchronous X protocol transactions. This option makes it easier to track down potential X protocol errors. Introduction to OpenGL Display-Window Management Using GLUT Next, we can state that a display window is to be created on the screen with a given caption for the title bar. This is accomplished with the function glutCreateWindow ("An Example OpenGL Program"); where the single argument for this function can be any character string that we want to use for the display-window title. ("An Example OpenGL Program"); Introduction to OpenGL Display-Window Management Using GLUT Then we need to specify what the display window is to contain. For this, we create a picture using OpenGL functions and pass the picture definition to the GLUT routine glutDisplayFunc, which assigns our picture to the display window. As an example, suppose we have the OpenGL code for describing a line segment in a procedure called lineSegment. Then the following function call passes the line-segment description to the display window: glutDisplayFunc (lineSegment); Introduction to OpenGL Display-Window Management Using GLUT But the display window is not yet on the screen. We need one more GLUT function to complete the window-processing operations. After execution of the following statement, all display windows that we have created, including their graphic content, are now activated: glutMainLoop ( ); This function must be the last one in our program. It displays the initial graphics and puts the program into an infinite loop that checks for input from devices such as a mouse or keyboard. Without glutMainLoop, your screen will disappear directly after execution. Introduction to OpenGL Display-Window Management Using GLUT Although the display window that we created will be in some default location and size, we can set these parameters using additional GLUT functions. We use the glutInitWindowPosition function to give an initial location for the upper- left corner of the display window. Introduction to OpenGL Display-Window Management Using GLUT This position is specified in integer screen coordinates, whose origin is at the upper-left corner of the screen. For instance, the following statement specifies that the upper-left corner of the display window should be placed 50 pixels to the right of the left edge of the screen and 100 pixels down from the top edge of the screen: glutInitWindowPosition (50, 100); Introduction to OpenGL Display-Window Management Using GLUT Similarly, the glutInitWindowSize function is used to set the initial pixel width and height of the display window. Thus, we specify a display window with an initial width of 400 pixels and a height of 300 pixels with the statement glutInitWindowSize (400, 300); Introduction to OpenGL Display-Window Management Using GLUT After the display window is on the screen, we can reposition and resize it. We can also set a number of other options for the display window, such as buffering and a choice of color modes, with the glutInitDisplayMode function. Arguments for this routine are assigned symbolic GLUT constants. For example, the following command specifies that a single refresh buffer is to be used for the display window and that we want to use the color mode which uses red, green, and blue (RGB) components to select color values: glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); Introduction to OpenGL A Complete OpenGL Program. For the display window, we can choose a background color. And we need to construct a procedure that contains the appropriate OpenGL functions for the picture that we want to display. Using RGB color values, we set the background color for the display window to be white, as in Figure 2, with the OpenGL function: glClearColor (1.0, 1.0, 1.0, 0.0); Introduction to OpenGL A Complete OpenGL Program glClearColor (1.0, 1.0, 1.0, 0.0); The first three arguments in this function set the red, green, and blue component colors to the value 1.0, giving us a white background color for the display window. If, instead of 1.0, we set each of the component colors to 0.0, we would get a black background. And if all three of these components were set to the same intermediate value between 0.0 and 1.0, we would get some shade of gray. Introduction to OpenGL A Complete OpenGL Program glClearColor (1.0, 1.0, 1.0, 0.0); The fourth parameter in the glClearColor function is called the alpha value for the specified color. One use for the alpha value is as a “blending” parameter. When we activate the OpenGL blending operations, alpha values can be used to determine the resulting color for two overlapping objects. An alpha value of 0.0 indicates a totally transparent object, and an alpha value of 1.0 indicates an opaque object. معتم Introduction to OpenGL A Complete OpenGL Program Although the glClearColor command assigns a color to the display window, it does not put the display window on the screen. To get the assigned window color displayed, we need to invoke the following OpenGL function: glClear (GL_COLOR_BUFFER_BIT); The argument GL_ COLOR_ BUFFER _BIT is an OpenGL symbolic constant specifying that it is the bit values in the color buffer (refresh buffer) that are to be set to the values indicated in the glClearColor function. (OpenGL has several different kinds of buffers that can be manipulated. Introduction to OpenGL A Complete OpenGL Program In addition to setting the background color for the display window, we can choose a variety of color schemes for the objects we want to display in a scene. For our initial programming example, we will simply set the object color to be a dark green: glColor3f (0.0, 0.4, 0.2); The suffix 3f on the glColor function indicates that we are specifying the three RGB color components using floating-point (f) values. This function requires that the values be in the range from 0.0 to 1.0, and we have set red 0.0, green 0.4, and blue 0.2. Introduction to OpenGL A Complete OpenGL Program For our first program, we simply display a two-dimensional line segment. To do this, we need to tell OpenGL how we want to “project” our picture onto the display window because generating a two- dimensional picture is treated by OpenGL as a special case of three- dimensional viewing. So, although we only want to produce a very simple two-dimensional line, OpenGL processes our picture through the full three-dimensional viewing operations. We can set the projection type (mode) and other viewing parameters that we need with the following two functions: glMatrixMode (GL_PROJECTION); gluOrtho2D (0.0, 200.0, 0.0, 150.0); Introduction to OpenGL A Complete OpenGL Program gluOrtho2D (0.0, 200.0, 0.0, 150.0); This specifies that an orthogonal projection is to be used to map the contents of a two-dimensional rectangular area of world coordinates to the screen, and that the x-coordinate values within this rectangle range from 0.0 to 200.0, with y-coordinate values ranging from 0.0 to 150.0. Whatever objects we define window. Introduction to OpenGL A Complete OpenGL Program Anything outside this coordinate range will not be displayed. gluOrtho2D (0.0, 200.0, 0.0, 150.0); Therefore, the GLU function gluOrtho2D defines the coordinate reference frame within the display window to be (0.0, 0.0) at the lower-left corner of the display window and (200.0, 150.0) at the upper- right window corner. Since we are only describing a two-dimensional object, the orthogonal projection has no other effect than to “paste” our picture into the display window that we defined earlier. For now, we will use a world-coordinate rectangle with the same aspect ratio as the display window, so that there is no distortion of our picture. Later, we will consider how we can maintain an aspect ratio that does not depend upon the display window specification. Introduction to OpenGL A Complete OpenGL Program Finally, we need to call the appropriate OpenGL routines to create our line segment. The following code defines a two-dimensional, straight-line segment with integer, Cartesian endpoint coordinates (180, 15) and (10, 145). glBegin (GL_LINES); glVertex2i (180, 15); glVertex2i (10, 145); glEnd ( ); #include // (or others, depending on the system in use) void init (void) { glClearColor (1.0, 1.0, 1.0, 0.0); // Set display-window color to white. glMatrixMode (GL_PROJECTION); // Set projection parameters. gluOrtho2D (0.0, 200.0, 0.0, 150.0); } void lineSegment (void) { glClear (GL_COLOR_BUFFER_BIT); // Clear display window. glColor3f (0.0, 0.4, 0.2); // Set line segment (or any other object) color to green. glBegin (GL_LINES); glVertex2i (180, 15); // Specify line-segment geometry. glVertex2i (10, 145); glEnd ( ); glFlush ( ); // Process all OpenGL routines as quickly as possible. } int main (int argc, char** argv) { glutInit (&argc, argv); // Initialize GLUT. glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // Set display mode. (single buffer with RGB) glutInitWindowPosition (50, 100); // Set top-left display-window position. glutInitWindowSize (400, 300); // Set display-window width and height. glutCreateWindow ("An Example OpenGL Program"); // Create display window. init ( ); // Execute initialization procedure. glutDisplayFunc (lineSegment); // Send graphics to display window. glutMainLoop ( ); // Display everything and wait. } Introduction to OpenGL glFlush glFlush: This is simply a routine to force execution of our OpenGL functions, which are stored by computer systems in buffers in different locations, depending on how OpenGL is implemented. On a busy network, for example, there could be delays in processing some buffers. But the call to glFlush forces all such buffers to be emptied and the OpenGL functions to be processed Introduction to OpenGL lineSegment The procedure lineSegment that we set up to describe our picture is referred to as a display callback function. And this procedure is described as being “registered” by glutDisplayFunc as the routine to invoke whenever the display window might need to be redisplayed. This can occur, for example, if the display window is moved. In subsequent chapters, we will look at other types of callback functions and the associated GLUT routines that we use to register them. In general, OpenGL programs are organized as a set of callback functions that are to be invoked when certain actions occur Summary In this chapter, we surveyed the major features of graphics software systems. Some software systems, such as CAD packages and paint programs, are designed for particular applications. Other software systems provide a library of general graphics routines that can be used within a programming language such as C++ to generate pictures for any application. Summary Standard graphics-programming packages developed and approved through ISO and ANSI are GKS, 3D GKS, PHIGS, and PHIGS+. Other packages that have evolved into standards are GL and OpenGL. Many other graphics libraries are available for use in a programming language, including Open Inventor, VRML, RenderMan, Java 2D, and Java 3D. Other systems, such as Mathematica, MatLab, and Maple, often provide a set of graphics-programming functions. Normally, graphics-programming packages require coordinate specifications to be given in Cartesian reference frames. Each object for a scene can be defined in a separate modeling Cartesian-coordinate system, which is then mapped to a world- coordinate location to construct the scene. From world coordinates, three- dimensional objects are projected to a two-dimensional plane, converted to normalized device coordinates, and then transformed to the final display device coordinates. The transformations from modeling coordinates to normalized device coordinates are independent of particular output devices that might be used in an application. Device drivers are then used to convert normalized coordinates to integer device coordinates. Summary Functions that are available in graphics programming packages can be divided into the following categories: graphics output primitives, attributes, geometric and modeling transformations, viewing transformations, input functions, picture-structuring operations, and control operations. Summary The OpenGL system consists of a device-independent set of routines (called the core library), the utility library (GLU), and the utility toolkit (GLUT). In the auxiliary set of routines provided by GLU, functions are available for generating complex objects, for parameter specifications in two-dimensional viewing applications, for dealing with surface-rendering operations, and for performing some other supporting tasks. In GLUT, we have an extensive set of functions for managing display windows, interacting with screen-window systems, and for generating some three- dimensional shapes. We can use GLUT to interface with any computer system, or we can use GLX, Apple GL, WGL, or another system specific software package.