L3
L3
GL
Content
1. Coordinate Representations
2. Graphics Functions
3. Software Standards
4. Other Graphics Packages
5. Introduction to OpenGL
Computer Graphics Software
Graphics Software
Special-purpose packages General programming
packages
Designed for nonprogrammers who want Designed for computer programmers.
to generate pictures, graphs, or charts,
etc.
The interface is a set of menus that Provides a library of graphics functions
allow users to communicate with the that can be used in a programming
programs in their own terms. language such as C, C++, Java, or
Fortran.
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.
Examples of such applications include Examples are GL (Graphics Library),
artists' painting programs and various OpenGL, VRML (Virtual-Reality Modeling
architectural, business, medical, and Language), Java 2D, and Java 3D.
engineering CAD systems.
Computer Graphics Software
(xmc, ymc, zmc) → (xwc , ywc , zwc) → (xvc , yvc , zvc) → (xpc , ypc ,
zpc)→ (xnc , ync , znc) → (xdc, ydc).
Graphics Functions
Prefix gl
Each component word in the function name has its first letter
capitalized
Arguments are assigned symbolic constants specifying parameter
names, values of parameters, or a mode.
Constants defined with GL_, and underscores separate words.
OpenGL defines its own types which correspond to C types GLbyte:
signed char; GLshort:short; GLint: int; GLfloat: float…
Related Libraries
• Related libraries for specific windowing systems:
• GLX: X-Window System (Linux, Unix, OS X)
Prefix glx
• For most applications we will also need GLU, and on many systems
we will need to include the header file for the window system.
• For the OpenGL and GLU, the source code must begin with:
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
• We can replace the header files for OpenGL and GLUT with:
#include <windows.h>
#include <GL/glut.h>
Display Video Management Using Glut
• To set the buffering the the color mode, we can use with
the glutInitDisplayMode function.
• 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);
The first three values are for the Red, Green and Blue, and the fourth
value is an alpha value if 0.0 means a transparent color, and if 0.1
means an opaque color.
A Complete OpenGL Program