....::::Menu::::....
...::About::...
...::Articles::...
...::Contact::...
...::Home & News::...
...::Links & Credits::...
|
About OpenGL
Goal of this file
This files is here to offer the reader a short introduction to what OpenGL is and does, how it looks like what terms like glut, glx and
glu mean and how they fit in the OpenGL picture. Consider this text as being the introduction.
History of this file
- 11 august 2003: created
- 12 august 2003: added a paragraph about function name convenctions
Introduction to OpenGL
OpenGL (= Open Graphics Library) is a widely used and cross platform graphics
programming API, which
means OpenGL is a bunch of function calls capable of creating and controlling the coloring of pixels on your screen. It doesn't to it on
a low level (no assembly requiered and such), it doesn't do it on a high level (there is no gl_draw_house() function). It does it by
creating, transforming, coloring vertices. This basicly means you can do a lot with OpenGL but it might take some work.
OpenGL has some advantages towards other graphics API's like DirectX, the biggest advantage is the fact that OpenGL is platform
indepentant. OpenGL was created by Silicon Graphics (SGI) to run on Irix workstations but
now it is available on each platform this is because OpenGL does not contain functions that are related to other things like for
example creating a window. So if you plan to write an OpenGL application just include GL/gl.h at the top won't make the world move.
This is where GLUT (OpenGL Utility Toolkit) and GLX come in, GLX is the OpenGL extension to the X window system
(which merges xlib programming with OpenGL
programming) on the other hand you have the GLUT API (which is covered in the following section). The GLUT API provides a beginning
OpenGL programming with the ability to create a window capable of showing OpenGL content and handling basic events. GLUT is very easy
to learn and I suggest first you spend some time learning GLUT and after a while when you're used to GLUT and you feel GLUT is getting
too easy for you should consider another framework like basicly going to GLX or other windowing API's like the GTK toolkit which has
also support for a gtkglarea.
You can tell to which API the function belongs by looking at the function, all OpenGL functions start with a gl prefix like
glClearColor, GLUT functions start with a glut prefix like glutInitDisplayMode and GLU functions start with a glu prefix
like gluLookAt. The same convention is used for variable types like GLfloat and for constants like GL_CLEAR_COLOR and GLUT_RGBA. Another
convention you should be aware of is that an OpenGL function that exists in multiple forms for exemple glVertex2f, glVertex2i,
glVertex3f and glVertex3i. The first defines a vertex in 2D space, the coordinates are floats, the second does the same but takes
only ints, the third takes floats and defines a vertex in 3D and the last uses ints in 3D. So by looking at a function you can
get a whole bunch of information about the function. To which API it belongs, which parameters it takes etc.
Now another advantage of OpenGL is that is it stable, most videocards have native OpenGL support, it is an industry standard, the ARB
(architectural review board) controls the evolution of OpenGL.
On Linux there is a free implementation of the OpenGL API available and probably installed on your system, this is the
MESA3D package. This isn't an official OpenGL version but it aims towards
compatibility with the official OpenGL implementation..
Most of the articles I will write will use the GLUT API for handling windows and events. In the first place compatibility with Linux
and C++ will be an aim. If the site reaches a more final form I might include support for other API's / platforms. The installation
and usage of GLUT is covered in the next artical called An
Introduction to GLUT. Fully understanding the GLUT API is needed to understand and to be able to experiment with all the next
articles. I will try to add a few new subjects in each article but understanding GLUT is a base you should have.
|