034 035














Open GL Super Bible:Learning OpenGL with the AUX Library















To access the contents, click the chapter and section titles.


Open GL Super Bible


(Publisher: Macmillan Computer Publishing)

Author(s): Waite group Press

ISBN: 1571690735

Publication Date: 08/01/96

 




Previous
Table of Contents
Next




The AUX Library
For the remainder of this chapter, you will learn to use the Auxiliary (AUX) library as a way to learn OpenGL. The AUX library was created to facilitate the learning and writing of OpenGL programs without being distracted by the minutiae of your particular environment, be it UNIX, Windows, or whatever. You donÅ‚t write “final" code when using AUX; it is more of a preliminary staging ground for testing your ideas. A lack of basic GUI features limits the libraryÅ‚s use for building useful applications.

A set of core AUX functions is available on nearly every implementation of OpenGL. These functions handle window creation and manipulation, as well as user input. Other functions draw some complete 3D figures as wireframe or solid objects. By using the AUX library to create and manage the window and user interaction, and OpenGL to do the drawing, it is possible to write programs that create fairly complex renderings. You can move these programs to different environments with a recompile.
In addition to the core functions, each environment that implements an AUX library also implements some other helper functions to enable system-specific operations such as buffer swapping and image loading. The more your code relies on these additional AUX library functions, the less portable your code will be. On the other hand, by making full use of these functions you can create fantastic scenes that will amaze your friends and even the family dogwithout having to learn all the gritty details of Windows programming.
Unfortunately, itłs unlikely that all of the functionality of a useful application will be embodied entirely in the code used to draw in 3D, so you canłt rely entirely on the AUX library for everything. Nevertheless, the AUX library excels in its role for learning and demonstration exercises. And for some applications, you may be able to employ the AUX library to iron out your 3D graphics code before integrating it into a complete application.
Platform Independence
OpenGL is a powerful and sophisticated API for creating 3D graphics, with over 300 commands that cover everything from setting material colors and reflective properties to doing rotations and complex coordinate transformations. You may be surprised that OpenGL has not a single function or command relating to window or screen management. In addition, there are no functions for keyboard input or mouse interaction. Consider, however, that one of the primary goals of the OpenGL designers was platform independence. Creating and opening a window is done differently under the various platforms. Even if OpenGL did have a command for opening a window, would you use it or would you use the operating systemłs own built-in API call?

Another platform issue is the handling of keyboard and mouse input events under the different operating systems and environments. If every environment handled these the same, we would have only one environment to worry about and thus no need for an “open" API. This is not the case, however, and it probably wonÅ‚t be within our brief lifetimes! So OpenGLÅ‚s platform independence comes at the cost of OS and GUI functions.
AUX = Platform I/O, the Easy Way
The AUX library was initially created as a toolkit to enable learning OpenGL without getting mired in the details of any particular operating system or user interface. To accomplish this, AUX provides rudimentary functions for creating a window and for reading mouse and keyboard activity. Internally, the AUX library makes use of the native environmentłs APIs for these functions. The functions exposed by the AUX library then remain the same on all platforms.

The AUX library contains only a handful of functions for window management and the handling of input events, but saves you the trouble of managing these in pure C or C++ through the Windows API. The library also contains functions for drawing some relatively simple 3D objects such as a sphere, cube, torus (doughnut), and even a teapot. With very little effort, you can use the AUX library to display a window and perform some OpenGL commands. Though AUX is not really part of the OpenGL specification, it seems to follow that spec around to every platform to which OpenGL is ported. Windows is no exception, and the source code for the AUX library is even included free in the Win32 SDK from Microsoft.



Previous
Table of Contents
Next














 


Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.












Wyszukiwarka

Podobne podstrony:
034 035
034 035
SHSpec 034 6108C04 Methodology of Auditing Not doingness and Occlusion
035 Elektroliza opis
035 12
034 036
v 06 034
035 Duszpasterstwo istota historyczny rozwoj
0356 To był twój błąd
v 03 035
035 17 (2)
035 10
035 Elektroliza ćwiczenie
2010 03, str 035 039

więcej podobnych podstron