GLee
GL Easy Extension Library
Version 5.4
By Ben Woodhouse
http://elf-stone.com
LICENSE
Copyright (c)2009 Ben Woodhouse All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer as
the first lines of this file unmodified.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY BEN WOODHOUSE ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL BEN WOODHOUSE BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CONTACT
Send any general questions, bug reports etc to me (Ben Woodhouse):
bw [at] elf-stone.com
Questions about the D port for GLee should go to Joel Anderson:
anderson [at] badmama.com.au
Questions about GLee on OS X should go to Tristam MacDonald
swiftcoder [at] gmail.com
INTRODUCTION
GLee provides a simple interface for using extensions and core OpenGL
functionality beyond OpenGL version 1.1, and automates the otherwise tedious
process of linking function pointers. GLee works with both C and C++
compilers.
Because the code is automatically generated, the latest extensions can
be included rapidly in new versions. Currently there is support
for OpenGL up to 3.0 and almost all registered extensions. For a complete
list of extensions, please see the accompanying extensionList.txt file.
For extension specifications, please visit:
http://www.opengl.org/registry/
CREDITS
Tristam MacDonald for adding OS-X compatibility.
Martin B點hler (LousyPhreak on the GameDev.net forums) for
a huge amount of testing, tweaking, suggestions and advice to get GLee to
work properly with Linux.
Daniel Jo (Ostsol on the OpenGL.org forums) for helping to get
GLEE 2.1 working with the OGLSL extensions (ARB_shader_objects,
ARB_vertex_shader and ARB_fragment_shader).
Joel Anderson for his for his D port of GLee 3.0
Jacques Beaurain for pointing out a potential access violation in
__GLeeGetExtensions.
WHAT'S NEW IN GLEE 5.0
GLeeGen, the program that generates the code for the GLee library, has been
rewritten to support parsing of extension specifications. As a result, GLee 5.0 and upwards support
all extensions for which there is a specification, regardless of that
extension's inclusion in glext.h, wglext.h or glxext.h.
GLee 5.0 adds support for forced extension loading through the
GLeeForceLink function. This makes it possible to force the linking of
extension functions (or core functions) which are not reported by the video driver.
GLee now supports lazy loading of extensions, meaning it is no longer
necessary to call GLeeInit() at initialisation time.
HOW TO INSTALL
MSVC 2003 binary version
1. Copy GLee.lib to your visual C++ lib directory
(eg C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib)
2. Copy GLee.h to your visual C++ include\GL directory
(eg C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\gl)
Linux binary version (GLee-*-bin.tar.gz)
(Installation has to be done as root)
1. unpack GLee-*-bin.tar.gz
(tar -xzf GLee-2.0-bin.tar.gz)
2. Install with the inst script
(cd glee && ./inst)
Linux source version (GLee-*-src.tar.gz)
1. unpack GLee-*-src.tar.gz
(tar -xzf GLee-2.0-src.tar.gz)
2. cd to "glee" and run the gnu build chain
(cd glee && ./configure && make)
3. Become root (password needed)
(su)
4. Install the lib
(make install)
HOW TO USE
If you're using the binary version then you'll need to link to
glee.lib and #include <gl\glee.h> in your project. Otherwise,
just add glee.h and glee.c in your project and #include "glee.h".
You can also build the library yourself using glee.c and glee.h.
From this point onwards, you should have access to all OpenGL
extensions and core functionality.
You can query the availability of an extension like this:
if (GLEE_ARB_point_parameters)
{
//GL_ARB_point_parameters is supported
glPointParameterfARB(...);
}
WGL extensions have a GLEE_WGL_ prefix. For example,
GLEE_WGL_ARB_pbuffer. GLX extensions work in a similar way.
You can also query the OpenGL version:
if (GLEE_VERSION_1_3)
{
//OpenGL 1.3 is supported
glLoadTransposeMatrixf(...) ;
...
}
ERROR CHECKING
Optionally, you can add a call to GLeeInit() after your OpenGL
initialisation code, however this is no longer required as of
GLee 5.0. GLeeInit returns a boolean value to indicate success
or failure.
If GLeeInit returns false you can get more detailed error
information by calling GLeeGetErrorString(). This returns a pointer
to a string which contains error description(s).
At any time you can call GLeeGetExtStrGL() or GLeeGetExtStrWGL()
(win32) or GLeeGetExtStrGLX() (linux) to retrieve a pointer to the
corresponding extension list string.
FORCED EXTENSION SUPPORT
By default, only those extensions reported by OpenGL's
glGetString(GL_EXTENSIONS) are loaded by GLeeInit(). Likewise,
only core functions whose version doesn't exceed the version number
returned by glGetString(GL_VERSION) are loaded.
However, GLee 5.0 and above can load additional extension and core
functions using the GLeeForceLink function:
GLint GLeeForceLink(const char * extensionName)
For example, GLeeForceLink("GL_ARB_point_parameters") will attempt to
load the ARB_point_parameters function.
For core functions, you can use the GL version string for the version
you wish to initialise. For example, GLeeForceLink( "GL_VERSION_2_0" )
will attempt to initialise OpenGL 2.0 core functions.
Return Value:
GLEE_LINK_COMPLETE is returned if all functions were
successfully linked.
GLEE_LINK_PARTIAL is returned if only some functions were
linked successfully.
GLEE_LINK_FAIL is returned if no functions could be linked
successfully.
Functions which could not be linked will be set to NULL.
A successful link does not guarantee that a function will work
correctly. If you want to be safe, only use extensions which are
reported by the driver.
LINUX NOTES - by LousyPhreak
The binary version was compiled with gcc 3.3 and was also tested
with gcc 3.2, but if you still have gcc 2.x you need the source
version. If you don't know which version you have on your system just
look at the output of 'gcc --version'.
You should be using the NVIDIA headers if you have the NVIDIA drivers
installed, and the MESA headers otherwise.
One more note:
The binary version might complain about missing glXGetProcAddressARB
on the linker stage, but if you get this error, use the source
version and email me (lousyphreak [at] gmx.at).
Compiling on linux:
You just need to replace the linking of libGL by libGLee:
gcc main.cpp whatever.cpp -lGLee -o myproject
Everything else should be the same as on windows.
NOTES ON THE GLEE 3.0 D PORT FOR WIN32 - by Joel Anderson
1) Put the GLee.lib in the lib folder (ie C:\
- 1
- 2
- 3
- 4
- 5
- 6
前往页