Sign in to follow this  
Drew_Benton

GLee Appreciation Thread

Recommended Posts

GLee was one of those libraries that I'd thought I'd never need need, mostly because of not knowing what it really did. I've been working on a little SDL engine for fun in my spare time and had some troubles with the BSP tutorials from GT. Mainly the OpenGL process loading, wglGetProcAddress. For some odd reason, I just couldn't get it to work correctly. Anyways, I remembered Glee and gave it a try. It took me a few minutes to get it to link properly, due to having to include it before any other OpenGL libraries, but all that had to be done was include the .C file, include the .H file and it linked perfectly. After that, I took out all of the function loading code which looked like this:
if( !glActiveTextureARB )
{
	// Initialize the multitexturing function pointers
	glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
	if( !glActiveTextureARB )
		throw("glActiveTextureARB extension was not loaded.");
}

if( !glClientActiveTextureARB )
{
	glClientActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glClientActiveTextureARB");
	if( !glClientActiveTextureARB )
		throw("glClientActiveTextureARB extension was not loaded.");
}


And took out the other variables for it:
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);

// These are the functions that we use for doing multitexturing
extern PFNGLACTIVETEXTUREARBPROC		glActiveTextureARB;
extern PFNGLCLIENTACTIVETEXTUREARBPROC  glClientActiveTextureARB;


And it's all ready! I simply compiled and it worked perfectly with no changes! So two thumbs up to Benjamin Bunny, and I encourage to give this great library a try if you are having trouble getting those extensions o work. [smile]

Share this post


Link to post
Share on other sites
yes, GLee is indeed great [grin]
I've been using it since some of the earliest public released by Ben and its an intergral part of my OpenGL Window Framework.

GLee is also the offical extension loader for the up and coming More OpenGL Game Programming and Dave has said that if Ben ever cant support it Gamedev.net will take up the support of it, something which if it did happen I'd certainly be wanting to get involved with [grin]

So yes, GLee is indeed great [grin]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Icefox
Okay, I'll bite.
What is GLee?


Have a look at the web page for everything, but a few quick excerpts from it:

Quote:
The OpenGL Easy Extension library (GLee) makes life easier for OpenGL developers by automatically linking OpenGL extensions and core functions at initialisation time. This saves programmers the effort of manually linking every required extension, and effectively brings the OpenGL library up to date.


Now to use a feature of it:

#include <gl\GLee.h> //no need to link to gl.h
...
if (GLEE_ARB_multitexture) //is multitexture support available?
{
glMultiTexCoord2fARB(...); //safe to use multitexture
}
else
{
//fallback
}



Now you may be asking what's the big deal? The big deal is that the library does *everything* for you already. All you have to do is include the header file and you are all set. In that first code segment, imagine having to do all of that, well one line less, for *all* extnsions you wanted to use in a program. It has already been done for you! Best part is that it's an easy plug and play and you are all set. [smile]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this