Section 1.4. Development Environment


1.4. Development Environment

To develop OpenGL software, you need a development environment with the necessary libraries and header files:

  • The OpenGL header file and library

  • The GLU header file and library

  • The GLUT header file and library or platform-specific header files and libraries for your specific window system

How you obtain these components varies according to your chosen development platform. OpenGL® Distilled includes information on three popular development platforms: Apple Mac OS X, Linux, and Microsoft Windows.

To build the example source code, you'll also need to obtain libTIFF and GNU Make. See the book's Web site for information on obtaining these components for your specific development platform.

If you purchase from a reputable computer manufacturer a new computer with a graphics card that supports OpenGL, chances are that the system is already configured to run OpenGL with hardware acceleration. Graphics card manufacturers, however, frequently upgrade their device drivers to add features, fix issues, and enhance performance. To upgrade your graphics card's device driver, download the new version from the computer manufacturer's or graphics card manufacturer's Web site, and follow the installation instructions.

1.4.1. Apple Mac OS X

The Apple Developer Connection contains links to an extensive amount of OpenGL information, including documentation devoted to developing OpenGL applications in Mac OS X and tools for debugging and optimizing your Mac OS X OpenGL applications.

The Macintosh OpenGL Programming Guide, available from the following Web site, is an excellent source of information on developing OpenGL applications on Apple platforms:

     http://developer.apple.com/graphicsimaging/opengl 

OpenGL header and library files are located in the OpenGL framework directory on your Mac OS X system:

     /System/Library/Frameworks/OpenGL.framework 


AGL is one of Apple's platform-specific OpenGL interfaces and is discussed in Chapter 8, "Platform-Specific Interfaces." To build code that uses AGL, use the headers and libraries in the AGL framework directory:

     /System/Library/Framework/AGL.framework 


Most of the examples use the platform-independent GLUT interface, but this is also a supported interface on Apple platforms.

     /System/Library/Framework/GLUT.framework 


You can develop OpenGL applications on a Macintosh by using either the Xcode IDE or a makefile system that uses the GNU compilers directly. The example source code uses a makefile system and should compile from a shell prompt without modification. If you want to use Xcode, you'll have to configure it to use the appropriate frameworks. There are several OpenGL example programs that use Xcode on your Apple Mac OS X system.

     /Developer/Examples/OpenGL/GLUT 


Use these examples as a guide if you wish to develop using Xcode.

Visit the OpenGL® Distilled Web site to download the example code and view updated information on building it in Apple Mac OS X.

1.4.2. Linux

Example source code for OpenGL® Distilled was developed on a Red Hat Linux Enterprise WS system, but developing OpenGL in other Linux and many Unix systems should be similar.

Full Linux distributions typically include a development environment with OpenGL, GLU, GLUT or freeglut, and GLX headers and libraries. If your Linux system is missing these components, you should obtain Mesa. Mesa is a 3D API with an interface that is very similar to OpenGL. Many Linux distributions use Mesa for hardware-accelerated OpenGL. Mesa includes the OpenGL, GLU, GLUT, and GLX headers and libraries. For more information and to download the Mesa source, visit the Mesa Web site:

     http://www.mesa3d.org 

If you purchased your Linux system from a reputable computer manufacturer, it's probably configured for full hardware acceleration. Verify this with the glxinfo program. If you are installing a Linux system from scratch and your graphics card doesn't have an open-source driver, you'll need to visit your graphics card manufacturer's Web site to obtain a Linux driver. Otherwise, OpenGL rendering will be unaccelerated.

If your OpenGL header files are installed in the typical location (/usr/include/GL), you don't need a -I option to specify their location; the compiler should find them automatically. Typical link options for an OpenGL program include: -L/usr/X11R6/lib -lglut -lglu -lgl.

1.4.3. Microsoft Windows

The OpenGL development environment for Microsoft Windows has remained stable since Windows 98.[5] The following information is valid for Windows 98, Windows ME, Windows 2000, Windows XP, and Windows NT version 3.5 and later.

[5] Microsoft has announced plans to provide an updated OpenGL in future operating systems.

Microsoft Visual Studio .NET includes OpenGL version 1.1 headers and export stub library files. When linking your application, you'll need to specify opengl32.lib as an input library. Microsoft distributes the runtime dynamic link library opengl32.dll with the operating system.

In addition to the version 1.1 header file, you need glext.h to access post-1.1 features and extensions. Obtain the latest version of glext.h from the OpenGL Extension Registry Web site:

     http://oss.sgi.com/projects/ogl-sample/ABI/glxext.h 

Microsoft compilers include the GLU 1.2 header and export stub library files. Your application needs to link with glu32.lib. Microsoft Windows includes the runtime GLU dynamic link library as part of the operating system.

Download GLUT from the OpenGL Web site, http://www.opengl.org. Because there are many download options, be sure to download the precompiled binaries for Microsoft Windows, not the source code or binaries for another platform.

After downloading GLUT, you need to install it manually. You should have the following files:

  • glut.h, the GLUT header file

  • glut32.lib, the export stub library

  • glut32.dll, the runtime dynamic link library

Move glut.h into the GL subdirectory of the default include directory for your compiler. This varies from compiler to compiler but will always end in ...\include\GL. The files gl.h and glu.h should already be in this directory.

Move glut32.lib into the default lib directory for your compiler.

Finally, move glut32.dll into the System32 directory for your operating system (for example, C:\Windows\System32) or any directory within your DLL search path.




OpenGL Distilled
OpenGL Distilled
ISBN: 0321336798
EAN: 2147483647
Year: 2007
Pages: 123
Authors: Paul Martz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net