GPU programming

    A. First Edition

    This is the assignment of comp7661 which asks you to have a taste of GPU programming. Basically I think it

    is not very hard if you know algorithm and write the setup framework by yourself.

    ¡¡

    B.The problem

Programming Assignment 2 Due: Mar 13, 2007

Description: The performance and functionality of graphics processors (GPUs) has been doubling every six months since mid-nineties. The primary application of GPUs has been fast rendering of anti-aliased, textured and shaded geometric primitives (e.g. polygons). With the advent of programmable GPUs we have the flexibility to program them to achieve more sophisticated results. Over the last few years, many new GPU based algorithms and applications that exploit their inherent parallelism and vector processing capabilities have been proposed. See www.gpgpu.org for more detailed examples and recent work in these areas.

The goal of this assignment is to help you get some familiarity with GPU programming. Using OpenGL Shading language(GLSL) you have to develop vertex/fragment shaders for motion blur and scene ripple effects.

For specific queries regarding this assignment or about using GLSL in H905, please e-mail to my Teaching Fellow for this course: sushil@cse.concordia.ca

##

## Reading:

Before starting you may want to read relevant sections from the following:

¡¤ OpenGL Shading specifications

¡¤ OpenGL Shading Language by Randi Rost (Also known as Orange book)

¡¤ www.3dshaders.com : This site has lots of shader examples.

Step1: Development Environment and Familiarisation

Download GLSLdemo source code. Create a folder and unzip it there. Make sure you can compile your project using visual studio. Visual studio project files can be found in vs7.1 or vs 7.0 directory depending on your version of visual studio. After compiling, if you run the program, you can see examples of the different effects possible using OpenGL shaders. You can study the source code for a few special effects that interest you. These can be found in shaders directory. The source directory contains the code required to couple OpenGL and OpenGL shading language. You will not need to modify any of those files.

Hence, this framework makes it easy for you to concentrate on writing OpenGL shaders without worrying about its interaction with OpenGL language, such as details of how to load models and textures in OpenGL etc. To experiment with your own shaders in this framework, you need to create an xml file similar to ¡°default.xml¡± or OrangeBook.xml¡± available in shaders directory. Try understanding and tweaking a few of the available shaders. Once you are comfortable with the basic structure of OpenGL shaders, you are ready for your assignment J

Each shader that you create will need to be placed in its own subdirectory under shaders directory. For a more detailed understanding consult source/xml.cpp. Basically this file is used for information exchange between your shaders and OpenGL application. An example would be a uniform variable named LightPosition. Basically you need to declare all uniforms, any specific models/textures you are using.

To load/test your own shaders, models and textures use File menu of application.

Step 2: Shader Programming Tasks

It is strongly recommended that you use the GLSL demo framework described in previous section for your shader development. This will ease many of the tasks. It is mandatory to implement the required effects listed below in the GPU i.e. effects should be implemented using GLSL shaders. You may choose any algorithm for getting the desired effects.

Task 1:

Implement Motion Blur: This effect blurs those parts of object which are in motion. See for example this image of amusement ride from wikipedia.

Task 2:

Implement Scene Ripple animation: In this effect the space is deformed and distorts the rendered image. It appears as though the object is immersed in a viscous, transparent fluid.

¡¡

Task 3: (Bonus)

Implement your own innovative extensions to the above shaders. (Considered only if both the above effects are implemented.)

¡¡

C.The idea of program
¡¡

GPU programming sounds difficult because at the old time you have to write assembly language. Now it is much, much easier to write in a kind of C-like pseudo code.

I feel difficult to use the "demo" given by professor. So, I modified the framework from RG who was using CG.

I throw this little assignment into garbage and almost forget everything about it even when I was taking the exam.

I mean I don't quite like this kind of "script-programming" cause you can learn it within a week. However, you are heavily depended on algorithms. If you don't understand graphic algorithm, you only have to copy and paste those codes in internet like most of those programming kids. :) Actually in this area, there are a lot of kids who are playing with tools made by gurus. How much do they know programming? I doubt it.

So, in order to keep an archive copy, I dig it up from my computer.
¡¡

    D.The major functions

    If you read the specification of GLSL, you would find it is almost like C except "uniform and varying". If you understand these, then you

    almost understand everything.

    E.Further improvement

    ¡¡

    F.File listing

    1. ply.h

    2. ply.c

    3. extsetup.h

    4. extsetup.c

    5. shader.h

    6. shader.cpp

    7. main.h

    8. main.cpp

    9. MotionBlur.vert

    10. MotionBlur.frag

    11. ripple.vert

    12. ripple.frag

    ¡¡

    ¡¡

    file name: ply.h

    /*+------------------------------------------------------------------
      ply.h - ply file header file

      Clifford M. Bryant, Jr.
    */

    #ifndef _PLY_H_
    #define _PLY_H_

    #include <string>
    #include <math.h>
    #include <GL/glut.h>

    using namespace std;

    #define RADDEG 57.29578
    #define DEGRAD 0.0174533

    // forward declaration
    class CPly;

    class CVertex
    {
    public:
    	CVertex() { n[0] = n[1] = n[2] = 0; }
    	// Increase the small fov's and decrease the large fov's.
    	static double getFovy()
    		{ double angle = 1.5 * RADDEG * atan( (max[1] - min[1]) / fabs(getDist()) );
    		  return ( (angle < 25) ? pow(25 / angle, .25) * angle :
    			       (angle > 45) ? sqrt(45 / angle) * angle : angle ); }
    	static double getAspect() { return ( max[0] - min[0] ) / ( max[1] - min[1] ); }
    	static double getDepth() { return ( max[2] - min[2] ); }
    	static double getNear() { return .5 * getDepth(); }
    	static double getFar() { return 10 * getDepth(); }
    	static double getDist() { return -2.5 * getDepth(); }
    	static void centerModel() { glTranslated( -(min[0] + max[0]) / 2,
    		-(min[1] + max[1]) / 2, -(min[2] + max[2]) / 2); }
    	static void reset() { min[0] = min[1] = min[2] = 1.e38; max[0] = max[1] = max[2] = -1.e38; }
    	static double getLight0X() { return (5 * (max[0] - min[0])); }
    	static double getLight0Y() { return (2 * (max[1] - min[1])); }
    	static double getLight1Y() { return (10 * (max[1] - min[1])); }
    	static double getLight2Y() { return (8 * (max[1] - min[1])); }
    	static double getLight2Z() { return (8 * (max[2] - min[2])); }
    	static double getLight2ZCenter() { return (max[2] + min[2]) / 2; }
    	void sumNormal(double * _n);
    	void normalize();
    	static double getXRange() { return (max[0] - min[0]); }
    	static double getYRange() { return (max[1] - min[1]); }

    	void calcStatistics();
    	double c[3];	// cordinate vector

    	double n[3];	// normal vector
    	static double min[3];
    	static double max[3];
    	friend istream & operator>>(istream & is, CVertex & v);
    	friend class CTriangle;
    	friend class CPly;  // for printing out dimension statistics
    };

    class CTriangle
    {
    public:
    	static void setVertices(CVertex * pVertices) { m_pVertices = pVertices; }
    	void draw();
    	void calcNormal();
    	void sumNormals();
    	static void setShading(int iShading) { m_iShading = iShading; }

    private:
    public: // RL kludge to get this to compile
    	int v[3];		// triangle vertices
    private: // RL return to private
    	double n[3];	// normal vector
    	static CVertex * m_pVertices;
    	static int m_iShading;
    	friend istream & operator>>(istream & is, CTriangle & t);
    };

    class CPly
    {
    public:
    	CPly() : m_pVertices(NULL), m_pTriangles(NULL) {}
    	~CPly() { if (m_pVertices) delete [] m_pVertices;
    		if (m_pTriangles) delete [] m_pTriangles; }
    	int read(const string strFilename);
    	void draw();
    	void calcNormals();

    private:
    	int m_iVertices;
    	CVertex * m_pVertices;
    	int m_iTriangles;
    	CTriangle * m_pTriangles;
    };

    #endif //_PLY_H_

    file name: ply.c (downloaded)

    /****************************************************************************************/
    /*
    /* Ply loader file.
    /* DATED 4th Oct 2004		RAMGOPAL R		r_rajago@cs.concordia.ca
    /* Acknowledgements - Code adapted from Clifford M. Bryant, Jr.'s base code.
    /* Updated by Ramngopal R, 6-Dec-05
    /****************************************************************************************/

    #include "windows.h"
    #include <fstream>
    #include <stdio.h>
    #include "ply.h"

    double CVertex::min[3];
    double CVertex::max[3];

    CVertex * CTriangle::m_pVertices = NULL;
    int CTriangle::m_iShading = GL_SMOOTH;

    int CPly::read(const string strFilename)
    {
    	ifstream ifs;
    	const int BUFF_SIZE = 256;
    	char buff[BUFF_SIZE];
    	string strBuffer;
    	string str;

    	// Open the ply file.
    	ifs.open(strFilename.c_str());
    	if (ifs.fail())
    	{
    		string strMsg = "Unable to open PLY file " + strFilename;
    		::MessageBox(NULL, strFilename.c_str(), "Open Error", MB_OK);
    		return -1;
    	}

    	// Read the ply file identifier
    	ifs >> strBuffer;
    	if (strBuffer != "ply")
    	{
    		string strMsg = "File " + strFilename + " is not a PLY file.";
    		::MessageBox(NULL, strFilename.c_str(), "File Error", MB_OK);
    		return -1;
    	}

    	// Skip the "format ascii 1.0" line.
    	ifs.getline(buff, BUFF_SIZE);
    	ifs.getline(buff, BUFF_SIZE);

    	// Read the number of vertices.
    	ifs >> str >> str >> m_iVertices;

    	// Skip over the 3 "property" lines.
    	ifs.getline(buff, BUFF_SIZE);
    	ifs.getline(buff, BUFF_SIZE);
    	ifs.getline(buff, BUFF_SIZE);
    	ifs.getline(buff, BUFF_SIZE);

    	// Read the number of polygons (triangles).
    	ifs >> str >> str >> m_iTriangles;

    	// Skip over the single "property" line and
    	// the end of the header indicator.
    	ifs.getline(buff, BUFF_SIZE);
    	ifs.getline(buff, BUFF_SIZE);
    	ifs.getline(buff, BUFF_SIZE);

    	// Allocate memory for the vertices.
    	if (m_pVertices) delete [] m_pVertices;
    	m_pVertices = new CVertex[m_iVertices];

    	// Read in the vertices.
    	CVertex::reset();
    	for (int i = 0; i < m_iVertices; i++)
    		ifs >> m_pVertices[i];

    	// Allocate memory for the triangles.
    	if (m_pTriangles) delete [] m_pTriangles;
    	m_pTriangles = new CTriangle[m_iTriangles];

    	CTriangle::setVertices(m_pVertices);

    	// Read in the triangles.
    	for (i = 0; i < m_iTriangles; i++)
    		ifs >> m_pTriangles[i];

    	return 0;
    }

    void CVertex::calcStatistics()
    {
    	min[0] = __min(c[0], min[0]);
    	min[1] = __min(c[1], min[1]);
    	min[2] = __min(c[2], min[2]);
    	max[0] = __max(c[0], max[0]);
    	max[1] = __max(c[1], max[1]);
    	max[2] = __max(c[2], max[2]);
    }

    void CVertex::sumNormal(double * _n)
    {
    	n[0] += _n[0];
    	n[1] += _n[1];
    	n[2] += _n[2];
    }

    void CVertex::normalize()
    {
    	// Normalize the normal vector.
    	double d = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
    	n[0] /= d;
    	n[1] /= d;
    	n[2] /= d;
    }

    istream & operator>>(istream & is, CVertex & v)
    {
    	is >> v.c[0] >> v.c[1] >> v.c[2];
    	v.calcStatistics();
    	return is;
    }

    void CTriangle::draw()
    {
    	if (m_iShading == GL_FLAT)
    	{
    		glBegin(GL_TRIANGLES);
    			glNormal3dv(n);
    			glVertex3dv(m_pVertices[v[0]].c);
    			glVertex3dv(m_pVertices[v[1]].c);
    			glVertex3dv(m_pVertices[v[2]].c);
    		glEnd();
    	}
    	else
    	{
    		glBegin(GL_TRIANGLES);
    			glNormal3dv(m_pVertices[v[0]].n);
    			glVertex3dv(m_pVertices[v[0]].c);
    			glNormal3dv(m_pVertices[v[1]].n);
    			glVertex3dv(m_pVertices[v[1]].c);
    			glNormal3dv(m_pVertices[v[2]].n);
    			glVertex3dv(m_pVertices[v[2]].c);
    		glEnd();
    	}
    }

    void CTriangle::calcNormal()
    {
    	double v1[3], v2[3];

    	// Calculate the two vectors from the three points.
    	v1[0] = m_pVertices[v[1]].c[0] - m_pVertices[v[0]].c[0];
    	v1[1] = m_pVertices[v[1]].c[1] - m_pVertices[v[0]].c[1];
    	v1[2] = m_pVertices[v[1]].c[2] - m_pVertices[v[0]].c[2];
    	v2[0] = m_pVertices[v[2]].c[0] - m_pVertices[v[1]].c[0];
    	v2[1] = m_pVertices[v[2]].c[1] - m_pVertices[v[1]].c[1];
    	v2[2] = m_pVertices[v[2]].c[2] - m_pVertices[v[1]].c[2];

    	// Take the cross product to get the normal vector.
    	n[0] = v1[1] * v2[2] - v2[1] * v1[2];
    	n[1] = v1[2] * v2[0] - v2[2] * v1[0];
    	n[2] = v1[0] * v2[1] - v2[0] * v1[1];

    	// Normalize the normal vector.
    	double d = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
    	n[0] /= d;
    	n[1] /= d;
    	n[2] /= d;
    }

    void CTriangle::sumNormals()
    {
    	m_pVertices[v[0]].sumNormal(n);
    	m_pVertices[v[1]].sumNormal(n);
    	m_pVertices[v[2]].sumNormal(n);
    }

    istream & operator>>(istream & is, CTriangle & t)
    {
    	int nv;
    	is >> nv >> t.v[0] >> t.v[1] >> t.v[2];
    	t.calcNormal();
    	return is;
    }

    void CPly::draw()
    {
    	for (int i = 0; i < m_iTriangles; i++)
    		m_pTriangles[i].draw();
    }

    void CPly::calcNormals()
    {
    	for (int i = 0; i < m_iTriangles; i++)
    		m_pTriangles[i].sumNormals();
    	for (i = 0; i < m_iVertices; i++)
    		m_pVertices[i].normalize();
    }

    file name: extsetup.h (downloaded)

    /*
    ** Copyright (C) 2003 ATI Technologies Inc.
    */

    #ifndef __EXTSETUP_H__
    #define __EXTSETUP_H__

    //#include <GL/glew.h>

    #include <gl/gl.h>
    //#include "glATI.h"
    #include <GL/glext.h>

    #ifdef WIN32
    //#include "wglATI.h"
    #include <GL/wglext.h>
    #else //Linux
    //#include "glxATI.h"
    #include <GL/glxext.h>
    #endif

    #ifdef __cplusplus
    extern "C" {
    #endif

    #ifdef GL_ARB_multisample
    extern GLboolean GL_ARB_multisample_Flag;
    extern PFNGLSAMPLECOVERAGEARBPROC glSampleCoverageARB;
    #endif

    #ifdef GL_ARB_multitexture
    extern GLboolean GL_ARB_multitexture_Flag;
    extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
    extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
    extern PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB;
    extern PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB;
    extern PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB;
    extern PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB;
    extern PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB;
    extern PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB;
    extern PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB;
    extern PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB;
    extern PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB;
    extern PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB;
    extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
    extern PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB;
    extern PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
    extern PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB;
    extern PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB;
    extern PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB;
    extern PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB;
    extern PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB;
    extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB;
    extern PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB;
    extern PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB;
    extern PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB;
    extern PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB;
    extern PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB;
    extern PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB;
    extern PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB;
    extern PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB;
    extern PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
    extern PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB;
    extern PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB;
    extern PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB;
    extern PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB;
    #endif

    #ifdef GL_ARB_texture_compression
    extern GLboolean GL_ARB_texture_compression_Flag;
    extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB;
    extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB;
    extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB;
    extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB;
    extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB;
    extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB;
    extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB;
    #endif

    #ifdef GL_ARB_transpose_matrix
    extern GLboolean GL_ARB_transpose_matrix_Flag;
    extern PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixfARB;
    extern PFNGLLOADTRANSPOSEMATRIXDARBPROC glLoadTransposeMatrixdARB;
    extern PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixfARB;
    extern PFNGLMULTTRANSPOSEMATRIXDARBPROC glMultTransposeMatrixdARB;
    #endif

    #ifdef GL_ARB_vertex_blend
    extern GLboolean GL_ARB_vertex_blend_Flag;
    extern PFNGLWEIGHTBVARBPROC glWeightbvARB;
    extern PFNGLWEIGHTSVARBPROC glWeightsvARB;
    extern PFNGLWEIGHTIVARBPROC glWeightivARB;
    extern PFNGLWEIGHTFVARBPROC glWeightfvARB;
    extern PFNGLWEIGHTDVARBPROC glWeightdvARB;
    extern PFNGLWEIGHTUBVARBPROC glWeightubvARB;
    extern PFNGLWEIGHTUSVARBPROC glWeightusvARB;
    extern PFNGLWEIGHTUIVARBPROC glWeightuivARB;
    extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB;
    extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
    #endif

    #ifdef GL_ARB_vertex_buffer_object
    extern GLboolean GL_ARB_vertex_buffer_object_flag;
    extern PFNGLBINDBUFFERARBPROC glBindBufferARB;
    extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
    extern PFNGLGENBUFFERSARBPROC glGenBuffersARB;
    extern PFNGLISBUFFERARBPROC glIsBufferARB;
    extern PFNGLBUFFERDATAARBPROC glBufferDataARB;
    extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB;
    extern PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB;
    extern PFNGLMAPBUFFERARBPROC glMapBufferARB;
    extern PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB;
    extern PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB;
    extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB;
    #endif

    #ifdef GL_ARB_window_pos
    extern GLboolean GL_ARB_window_pos_Flag;
    extern PFNGLWINDOWPOS2DARBPROC glWindowPos2dARB;
    extern PFNGLWINDOWPOS2FARBPROC glWindowPos2fARB;
    extern PFNGLWINDOWPOS2IARBPROC glWindowPos2iARB;
    extern PFNGLWINDOWPOS2SARBPROC glWindowPos2sARB;
    extern PFNGLWINDOWPOS2IVARBPROC glWindowPos2ivARB;
    extern PFNGLWINDOWPOS2SVARBPROC glWindowPos2svARB;
    extern PFNGLWINDOWPOS2FVARBPROC glWindowPos2fvARB;
    extern PFNGLWINDOWPOS2DVARBPROC glWindowPos2dvARB;
    extern PFNGLWINDOWPOS3IARBPROC glWindowPos3iARB;
    extern PFNGLWINDOWPOS3SARBPROC glWindowPos3sARB;
    extern PFNGLWINDOWPOS3FARBPROC glWindowPos3fARB;
    extern PFNGLWINDOWPOS3DARBPROC glWindowPos3dARB;
    extern PFNGLWINDOWPOS3IVARBPROC glWindowPos3ivARB;
    extern PFNGLWINDOWPOS3SVARBPROC glWindowPos3svARB;
    extern PFNGLWINDOWPOS3FVARBPROC glWindowPos3fvARB;
    extern PFNGLWINDOWPOS3DVARBPROC glWindowPos3dvARB;
    #endif

    #ifdef GL_ARB_vertex_program
    extern GLboolean GL_ARB_vertex_program_Flag;
    extern PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB;
    extern PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB;
    extern PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB;
    extern PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB;
    extern PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB;
    extern PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB;
    extern PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB;
    extern PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB;
    extern PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB;
    extern PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB;
    extern PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB;
    extern PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB;
    extern PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB;
    extern PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB;
    extern PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB;
    extern PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB;
    extern PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB;
    extern PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB;
    extern PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB;
    extern PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB;
    extern PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB;
    extern PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB;
    extern PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB;
    extern PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB;
    extern PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB;
    extern PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB;
    extern PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB;
    extern PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB;
    extern PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB;
    extern PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB;
    extern PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB;
    extern PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB;
    extern PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB;
    extern PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB;
    extern PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB;
    extern PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB;
    extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB;
    extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB;
    extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB;
    extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
    extern PFNGLBINDPROGRAMARBPROC glBindProgramARB;
    extern PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB;
    extern PFNGLGENPROGRAMSARBPROC glGenProgramsARB;
    extern PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB;
    extern PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB;
    extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB;
    extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB;
    extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB;
    extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB;
    extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB;
    extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB;
    extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB;
    extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB;
    extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB;;
    extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB;;
    extern PFNGLGETPROGRAMIVARBPROC glGetProgramivARB;;
    extern PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB;
    extern PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB;
    extern PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB;
    extern PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB;
    extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB;
    extern PFNGLISPROGRAMARBPROC glIsProgramARB;
    #endif

    #ifdef GL_ARB_fragment_program
    extern GLboolean GL_ARB_fragment_program_Flag;
    #ifndef GL_ARB_vertex_program
    extern PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
    extern PFNGLBINDPROGRAMARBPROC glBindProgramARB;
    extern PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB;
    extern PFNGLGENPROGRAMSARBPROC glGenProgramsARB;
    extern PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB;
    extern PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB;
    extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB;
    extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB;
    extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB;
    extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB;
    extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB;
    extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB;
    extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB;
    extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB;
    extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB;
    extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB;
    extern PFNGLGETPROGRAMIVARBPROC glGetProgramivARB;
    extern PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB;
    extern PFNGLISPROGRAMARBPROC glIsProgramARB;
    #endif
    #endif

    #ifdef GL_ARB_depth_texture
    extern GLboolean GL_ARB_depth_texture_Flag;
    #endif

    #ifdef GL_ARB_shadow
    extern GLboolean GL_ARB_shadow_Flag;
    #endif

    #ifdef GL_ARB_shadow_ambient
    extern GLboolean GL_ARB_shadow_ambient_Flag;
    #endif

    #ifdef GL_ARB_texture_cube_map
    extern GLboolean GL_ARB_texture_cube_map_Flag;
    #endif

    #ifdef GL_ARB_texture_env_add
    extern GLboolean GL_ARB_texture_env_add_Flag;
    #endif

    #ifdef GL_ARB_texture_env_combine
    extern GLboolean GL_ARB_texture_env_combine_Flag;
    #endif

    #ifdef GL_ARB_texture_env_crossbar
    extern GLboolean GL_ARB_texture_env_crossbar_Flag;
    #endif

    #ifdef GL_ARB_texture_env_dot3
    extern GLboolean GL_ARB_texture_env_dot3_Flag;
    #endif

    #ifdef GL_ARB_texture_border_clamp
    extern GLboolean GL_ARB_texture_border_clamp_Flag;
    #endif

    #ifdef GL_ARB_texture_mirror_repeat
    extern GLboolean GL_ARB_texture_mirror_repeat_Flag;
    #endif

    #ifdef GL_ARB_point_sprite
    extern GLboolean GL_ARB_point_sprite_Flag;
    #endif

    #ifdef GL_EXT_texture_object
    extern GLboolean GL_EXT_texture_object_Flag;
    extern PFNGLGENTEXTURESEXTPROC glGenTexturesEXT;
    extern PFNGLDELETETEXTURESEXTPROC glDeleteTexturesEXT;
    extern PFNGLBINDTEXTUREEXTPROC glBindTextureEXT;
    extern PFNGLPRIORITIZETEXTURESEXTPROC glPrioritizeTexturesEXT;
    extern PFNGLARETEXTURESRESIDENTEXTPROC glAreTexturesResidentEXT;
    extern PFNGLISTEXTUREEXTPROC glIsTextureEXT;
    #endif

    #ifdef GL_EXT_fog_coord
    extern GLboolean GL_EXT_fog_coord_Flag;
    extern PFNGLFOGCOORDFEXTPROC glFogCoordfEXT;
    extern PFNGLFOGCOORDDEXTPROC glFogCoorddEXT;
    extern PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT;
    extern PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT;
    extern PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT;
    #endif

    #ifdef GL_EXT_secondary_color
    extern GLboolean GL_EXT_secondary_color_Flag;
    extern PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3fEXT;
    extern PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3dEXT;
    extern PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3bEXT;
    extern PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3sEXT;
    extern PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3iEXT;
    extern PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ubEXT;
    extern PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3usEXT;
    extern PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3uiEXT;
    extern PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT;
    extern PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dvEXT;
    extern PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bvEXT;
    extern PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3svEXT;
    extern PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3ivEXT;
    extern PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXT;
    extern PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usvEXT;
    extern PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uivEXT;
    extern PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT;
    #endif

    #ifdef GL_EXT_draw_range_elements
    extern GLboolean GL_EXT_draw_range_elements_Flag;
    extern PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElementsEXT;
    extern PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElements;
    #endif

    #ifdef GL_EXT_multi_draw_arrays
    extern GLboolean GL_EXT_multi_draw_arrays_Flag;
    extern PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArraysEXT;
    extern PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElementsEXT;
    #endif

    #ifdef GL_EXT_texture3D
    extern GLboolean GL_EXT_texture3D_Flag;
    extern PFNGLTEXIMAGE3DEXTPROC glTexImage3DEXT;
    extern PFNGLTEXSUBIMAGE3DPROC glTexSubImage3DEXT;
    extern PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3DEXT;
    #endif

    #ifdef GL_EXT_point_parameters
    extern GLboolean GL_EXT_point_parameters_Flag;
    extern PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT;
    extern PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT;
    #endif

    #ifdef GL_ARB_point_parameters
    extern GLboolean GL_ARB_point_parameters_Flag;
    extern PFNGLPOINTPARAMETERFEXTPROC glPointParameterfARB;
    extern PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvARB;
    #endif

    #ifdef GL_EXT_vertex_shader
    extern GLboolean GL_EXT_vertex_shader_Flag;
    extern PFNGLBEGINVERTEXSHADEREXTPROC glBeginVertexShaderEXT;
    extern PFNGLENDVERTEXSHADEREXTPROC glEndVertexShaderEXT;
    extern PFNGLBINDVERTEXSHADEREXTPROC glBindVertexShaderEXT;
    extern PFNGLGENVERTEXSHADERSEXTPROC glGenVertexShadersEXT;
    extern PFNGLDELETEVERTEXSHADEREXTPROC glDeleteVertexShaderEXT;
    extern PFNGLSHADEROP1EXTPROC glShaderOp1EXT;
    extern PFNGLSHADEROP2EXTPROC glShaderOp2EXT;
    extern PFNGLSHADEROP3EXTPROC glShaderOp3EXT;
    extern PFNGLSWIZZLEEXTPROC glSwizzleEXT;
    extern PFNGLWRITEMASKEXTPROC glWriteMaskEXT;
    extern PFNGLINSERTCOMPONENTEXTPROC glInsertComponentEXT;
    extern PFNGLEXTRACTCOMPONENTEXTPROC glExtractComponentEXT;
    extern PFNGLGENSYMBOLSEXTPROC glGenSymbolsEXT;
    extern PFNGLSETINVARIANTEXTPROC glSetInvariantEXT;
    extern PFNGLSETLOCALCONSTANTEXTPROC glSetLocalConstantEXT;
    extern PFNGLVARIANTBVEXTPROC glVariantbvEXT;
    extern PFNGLVARIANTSVEXTPROC glVariantsvEXT;
    extern PFNGLVARIANTIVEXTPROC glVariantivEXT;
    extern PFNGLVARIANTFVEXTPROC glVariantfvEXT;
    extern PFNGLVARIANTDVEXTPROC glVariantdvEXT;
    extern PFNGLVARIANTUBVEXTPROC glVariantubvEXT;
    extern PFNGLVARIANTUSVEXTPROC glVariantusvEXT;
    extern PFNGLVARIANTUIVEXTPROC glVariantuivEXT;
    extern PFNGLVARIANTPOINTEREXTPROC glVariantPointerEXT;
    extern PFNGLENABLEVARIANTCLIENTSTATEEXTPROC glEnableVariantClientStateEXT;
    extern PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC glDisableVariantClientStateEXT;
    extern PFNGLBINDLIGHTPARAMETEREXTPROC glBindLightParameterEXT;
    extern PFNGLBINDMATERIALPARAMETEREXTPROC glBindMaterialParameterEXT;
    extern PFNGLBINDTEXGENPARAMETEREXTPROC glBindTexGenParameterEXT;
    extern PFNGLBINDTEXTUREUNITPARAMETEREXTPROC glBindTextureUnitParameterEXT;
    extern PFNGLBINDPARAMETEREXTPROC glBindParameterEXT;
    extern PFNGLISVARIANTENABLEDEXTPROC glIsVariantEnabledEXT;
    extern PFNGLGETVARIANTBOOLEANVEXTPROC glGetVariantBooleanvEXT;
    extern PFNGLGETVARIANTINTEGERVEXTPROC glGetVariantIntegervEXT;
    extern PFNGLGETVARIANTFLOATVEXTPROC glGetVariantFloatvEXT;
    extern PFNGLGETVARIANTPOINTERVEXTPROC glGetVariantPointervEXT;
    extern PFNGLGETINVARIANTBOOLEANVEXTPROC glGetInvariantBooleanvEXT;
    extern PFNGLGETINVARIANTINTEGERVEXTPROC glGetInvariantIntegervEXT;
    extern PFNGLGETINVARIANTFLOATVEXTPROC glGetInvariantFloatvEXT;
    extern PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC glGetLocalConstantBooleanvEXT;
    extern PFNGLGETLOCALCONSTANTINTEGERVEXTPROC glGetLocalConstantIntegervEXT;
    extern PFNGLGETLOCALCONSTANTFLOATVEXTPROC glGetLocalConstantFloatvEXT;
    #endif

    #ifdef GL_EXT_blend_minmax
    extern GLboolean GL_EXT_blend_minmax_Flag;
    extern PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT;
    #endif

    #ifdef GL_EXT_blend_func_separate
    extern GLboolean GL_EXT_blend_func_separate_Flag;
    extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT;
    #endif

    #ifdef GL_EXT_blend_color
    extern GLboolean GL_EXT_blend_color_Flag;
    extern PFNGLBLENDCOLOREXTPROC glBlendColorEXT;
    #endif

    #ifndef GL_EXT_polygon_offset
    extern GLboolean GL_EXT_polygon_offset_Flag;
    #endif

    #ifdef GL_EXT_vertex_array
    extern GLboolean GL_EXT_vertex_array_Flag;
    extern PFNGLARRAYELEMENTEXTPROC glArrayElementEXT;
    extern PFNGLDRAWARRAYSEXTPROC glDrawArraysEXT;
    extern PFNGLVERTEXPOINTEREXTPROC glVertexPointerEXT;
    extern PFNGLNORMALPOINTEREXTPROC glNormalPointerEXT;
    extern PFNGLCOLORPOINTEREXTPROC glColorPointerEXT;
    extern PFNGLINDEXPOINTEREXTPROC glIndexPointerEXT;
    extern PFNGLTEXCOORDPOINTEREXTPROC glTexCoordPointerEXT;
    extern PFNGLEDGEFLAGPOINTEREXTPROC glEdgeFlagPointerEXT;
    extern PFNGLGETPOINTERVEXTPROC glGetPointervEXT;
    #endif

    #ifdef GL_EXT_compiled_vertex_array
    extern GLboolean GL_EXT_compiled_vertex_array_Flag;
    extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
    extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
    #endif

    #ifdef GL_EXT_abgr
    extern GLboolean GL_EXT_abgr_Flag;
    #endif

    #ifdef GL_EXT_bgra
    extern GLboolean GL_EXT_bgra_Flag;
    #endif

    #ifdef GL_EXT_blend_subtract
    extern GLboolean GL_EXT_blend_subtract_Flag;
    #endif

    #ifdef GL_EXT_clip_volume_hint
    extern GLboolean GL_EXT_clip_volume_hint_Flag;
    #endif

    #ifdef GL_EXT_packed_pixels
    extern GLboolean GL_EXT_packed_pixels_Flag;
    #endif

    #ifdef GL_EXT_rescale_normal
    extern GLboolean GL_EXT_rescale_normal_Flag;
    #endif

    #ifdef GL_EXT_separate_specular_color
    extern GLboolean GL_EXT_separate_specular_color_Flag;
    #endif

    #ifdef GL_EXT_texgen_reflection
    extern GLboolean GL_EXT_texgen_reflection_Flag;
    #endif

    #ifdef GL_EXT_texture_cube_map
    extern GLboolean GL_EXT_texture_cube_map_Flag;
    #endif

    #ifdef GL_EXT_texture_compression_s3tc
    extern GLboolean GL_EXT_texture_compression_s3tc_Flag;
    #endif

    #ifdef GL_EXT_texture_edge_clamp
    extern GLboolean GL_EXT_texture_edge_clamp_Flag;
    #endif

    #ifdef GL_EXT_texture_env_add
    extern GLboolean GL_EXT_texture_env_add_Flag;
    #endif

    #ifdef GL_EXT_texture_env_combine
    extern GLboolean GL_EXT_texture_env_combine_Flag;
    #endif

    #ifdef GL_EXT_texture_env_dot3
    extern GLboolean GL_EXT_texture_env_dot3_Flag;
    #endif

    #ifdef GL_EXT_texture_filter_anisotropic
    extern GLboolean GL_EXT_texture_filter_anisotropic_Flag;
    #endif

    #ifdef GL_EXT_stencil_wrap
    extern GLboolean GL_EXT_stencil_wrap_Flag;
    #endif

    #ifdef GL_EXT_texture_rectangle
    extern GLboolean GL_EXT_texture_rectangle_Flag;
    #endif

    #ifdef GL_ATI_envmap_bumpmap
    extern GLboolean GL_ATI_envmap_bumpmap_Flag;
    extern PFNGLTEXBUMPPARAMETERIVATIPROC glTexBumpParameterivATI;
    extern PFNGLTEXBUMPPARAMETERFVATIPROC glTexBumpParameterfvATI;
    extern PFNGLGETTEXBUMPPARAMETERIVATIPROC glGetTexBumpParameterivATI;
    extern PFNGLGETTEXBUMPPARAMETERFVATIPROC glGetTexBumpParameterfvATI;
    #endif

    #ifdef GL_ATI_fragment_shader
    extern GLboolean GL_ATI_fragment_shader_Flag;
    extern PFNGLGENFRAGMENTSHADERSATIPROC glGenFragmentShadersATI;
    extern PFNGLBINDFRAGMENTSHADERATIPROC glBindFragmentShaderATI;
    extern PFNGLDELETEFRAGMENTSHADERATIPROC glDeleteFragmentShaderATI;
    extern PFNGLBEGINFRAGMENTSHADERATIPROC glBeginFragmentShaderATI;
    extern PFNGLENDFRAGMENTSHADERATIPROC glEndFragmentShaderATI;
    extern PFNGLPASSTEXCOORDATIPROC glPassTexCoordATI;
    extern PFNGLSAMPLEMAPATIPROC glSampleMapATI;
    extern PFNGLCOLORFRAGMENTOP1ATIPROC glColorFragmentOp1ATI;
    extern PFNGLCOLORFRAGMENTOP2ATIPROC glColorFragmentOp2ATI;
    extern PFNGLCOLORFRAGMENTOP3ATIPROC glColorFragmentOp3ATI;
    extern PFNGLALPHAFRAGMENTOP1ATIPROC glAlphaFragmentOp1ATI;
    extern PFNGLALPHAFRAGMENTOP2ATIPROC glAlphaFragmentOp2ATI;
    extern PFNGLALPHAFRAGMENTOP3ATIPROC glAlphaFragmentOp3ATI;
    extern PFNGLSETFRAGMENTSHADERCONSTANTATIPROC glSetFragmentShaderConstantATI;
    #endif

    #ifdef GL_ATI_vertex_array_object
    extern GLboolean GL_ATI_vertex_array_object_Flag;
    extern PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI;
    extern PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI;
    extern PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI;
    extern PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI;
    extern PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI;
    extern PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI;
    extern PFNGLARRAYOBJECTATIPROC glArrayObjectATI;
    extern PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI;
    extern PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI;
    extern PFNGLVARIANTARRAYOBJECTATIPROC glVariantArrayObjectATI;
    extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI;
    extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI;
    #endif

    #ifdef GL_ATI_element_array
    extern GLboolean GL_ATI_element_array_Flag;
    extern PFNGLELEMENTPOINTERATIPROC glElementPointerATI;
    extern PFNGLDRAWELEMENTARRAYATIPROC glDrawElementArrayATI;
    extern PFNGLDRAWRANGEELEMENTARRAYATIPROC glDrawRangeElementArrayATI;
    #endif

    #ifdef GL_ATI_vertex_attrib_array_object
    extern GLboolean GL_ATI_vertex_attrib_array_object_Flag;
    extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI;
    extern PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC glVertexAttribArrayObjectfvATI;
    extern PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC glVertexAttribArrayObjectivATI;
    #endif

    #ifdef GL_ATI_pn_triangles
    extern GLboolean GL_ATI_pn_triangles_Flag;
    extern PFNGLPNTRIANGLESIATIPROC glPNTrianglesiATI;
    extern PFNGLPNTRIANGLESFATIPROC glPNTrianglesfATI;
    #endif

    #ifdef GL_ATI_vertex_streams
    extern GLboolean GL_ATI_vertex_streams_Flag;
    extern PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC glClientActiveVertexStreamATI;
    extern PFNGLVERTEXBLENDENVIATIPROC glVertexBlendEnviATI;
    extern PFNGLVERTEXBLENDENVFATIPROC glVertexBlendEnvfATI;
    extern PFNGLVERTEXSTREAM2SATIPROC glVertexStream2sATI;
    extern PFNGLVERTEXSTREAM2SVATIPROC glVertexStream2svATI;
    extern PFNGLVERTEXSTREAM2IATIPROC glVertexStream2iATI;
    extern PFNGLVERTEXSTREAM2IVATIPROC glVertexStream2ivATI;
    extern PFNGLVERTEXSTREAM2FATIPROC glVertexStream2fATI;
    extern PFNGLVERTEXSTREAM2FVATIPROC glVertexStream2fvATI;
    extern PFNGLVERTEXSTREAM2DATIPROC glVertexStream2dATI;
    extern PFNGLVERTEXSTREAM2DVATIPROC glVertexStream2dvATI;
    extern PFNGLVERTEXSTREAM3SATIPROC glVertexStream3sATI;
    extern PFNGLVERTEXSTREAM3SVATIPROC glVertexStream3svATI;
    extern PFNGLVERTEXSTREAM3IATIPROC glVertexStream3iATI;
    extern PFNGLVERTEXSTREAM3IVATIPROC glVertexStream3ivATI;
    extern PFNGLVERTEXSTREAM3FATIPROC glVertexStream3fATI;
    extern PFNGLVERTEXSTREAM3FVATIPROC glVertexStream3fvATI;
    extern PFNGLVERTEXSTREAM3DATIPROC glVertexStream3dATI;
    extern PFNGLVERTEXSTREAM3DVATIPROC glVertexStream3dvATI;
    extern PFNGLVERTEXSTREAM4SATIPROC glVertexStream4sATI;
    extern PFNGLVERTEXSTREAM4SVATIPROC glVertexStream4svATI;
    extern PFNGLVERTEXSTREAM4IATIPROC glVertexStream4iATI;
    extern PFNGLVERTEXSTREAM4IVATIPROC glVertexStream4ivATI;
    extern PFNGLVERTEXSTREAM4FATIPROC glVertexStream4fATI;
    extern PFNGLVERTEXSTREAM4FVATIPROC glVertexStream4fvATI;
    extern PFNGLVERTEXSTREAM4DATIPROC glVertexStream4dATI;
    extern PFNGLVERTEXSTREAM4DVATIPROC glVertexStream4dvATI;
    extern PFNGLNORMALSTREAM3BATIPROC glNormalStream3bATI;
    extern PFNGLNORMALSTREAM3BVATIPROC glNormalStream3bvATI;
    extern PFNGLNORMALSTREAM3SATIPROC glNormalStream3sATI;
    extern PFNGLNORMALSTREAM3SVATIPROC glNormalStream3svATI;
    extern PFNGLNORMALSTREAM3IATIPROC glNormalStream3iATI;
    extern PFNGLNORMALSTREAM3IVATIPROC glNormalStream3ivATI;
    extern PFNGLNORMALSTREAM3FATIPROC glNormalStream3fATI;
    extern PFNGLNORMALSTREAM3FVATIPROC glNormalStream3fvATI;
    extern PFNGLNORMALSTREAM3DATIPROC glNormalStream3dATI;
    extern PFNGLNORMALSTREAM3DVATIPROC glNormalStream3dvATI;
    #endif

    #ifdef GL_ATI_separate_stencil
    extern GLboolean GL_ATI_separate_stencil_Flag;
    extern PFNGLSTENCILOPSEPARATEATIPROC glStencilOpSeparateATI;
    extern PFNGLSTENCILFUNCSEPARATEATIPROC glStencilFuncSeparateATI;
    #endif

    #ifdef GL_ATI_draw_buffers
    extern GLboolean GL_ATI_draw_buffers_Flag;
    extern PFNGLDRAWBUFFERSATIPROC glDrawBuffersATI;
    #endif

    #ifdef GL_ATI_texture_mirror_once
    extern GLboolean GL_ATI_texture_mirror_once_Flag;
    #endif

    #ifdef GL_ATI_texture_float
    extern GLboolean GL_ATI_texture_float_Flag;
    #endif

    #ifdef GL_ATIX_texture_env_combine3
    extern GLboolean GL_ATIX_texture_env_combine3_Flag;
    #endif

    #ifdef GL_ATIX_texture_env_route
    extern GLboolean GL_ATIX_texture_env_route_Flag;
    #endif

    #ifdef GL_ATIX_vertex_shader_output_point_size
    extern GLboolean GL_ATIX_vertex_shader_output_point_size_Flag;
    #endif

    #ifdef GL_NV_texgen_reflection
    extern GLboolean GL_NV_texgen_reflection_Flag;
    #endif

    #ifdef GL_NV_blend_square
    extern GLboolean GL_NV_blend_square_Flag;
    #endif

    #ifdef GL_NV_point_sprite
    extern GLboolean GL_NV_point_sprite_Flag;
    extern PFNGLPOINTPARAMETERINVPROC glPointParameteriNV;
    extern PFNGLPOINTPARAMETERIVNVPROC glPointParameterivNV;
    #endif

    #ifdef GL_ARB_occlusion_query
    extern GLboolean GL_ARB_occlusion_query_Flag;
    extern PFNGLGENQUERIESARBPROC        glGenQueriesARB;
    extern PFNGLDELETEQUERIESARBPROC     glDeleteQueriesARB;
    extern PFNGLISQUERYARBPROC           glIsQueryARB;
    extern PFNGLBEGINQUERYARBPROC        glBeginQueryARB;
    extern PFNGLENDQUERYARBPROC          glEndQueryARB;
    extern PFNGLGETQUERYIVARBPROC        glGetQueryivARB;
    extern PFNGLGETQUERYOBJECTIVARBPROC  glGetQueryObjectivARB;
    extern PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB;

    #endif		// Updated by @RG for accomodating ARB Occlusion query.

    #ifdef GL_NV_occlusion_query
    extern GLboolean GL_NV_occlusion_query_Flag;
    extern PFNGLGENOCCLUSIONQUERIESNVPROC glGenOcclusionQueriesNV;
    extern PFNGLDELETEOCCLUSIONQUERIESNVPROC glDeleteOcclusionQueriesNV;
    extern PFNGLISOCCLUSIONQUERYNVPROC glIsOcclusionQueryNV;
    extern PFNGLBEGINOCCLUSIONQUERYNVPROC glBeginOcclusionQueryNV;
    extern PFNGLENDOCCLUSIONQUERYNVPROC glEndOcclusionQueryNV;
    extern PFNGLGETOCCLUSIONQUERYIVNVPROC glGetOcclusionQueryivNV;
    extern PFNGLGETOCCLUSIONQUERYUIVNVPROC glGetOcclusionQueryuivNV;
    #endif

    #ifdef GL_HP_occlusion_test
    extern GLboolean GL_HP_occlusion_test_Flag;
    #endif

    #ifdef GL_S3_s3tc
    extern GLboolean GL_S3_s3tc_Flag;
    #endif

    #ifdef GL_SGI_texture_edge_clamp
    extern GLboolean GL_SGI_texture_edge_clamp_Flag;
    #endif

    #ifdef GL_SGIS_generate_mipmap
    extern GLboolean GL_SGIS_generate_mipmap_Flag;
    #endif

    #ifdef GL_SGIS_texture_border_clamp
    extern GLboolean GL_SGIS_texture_border_clamp_Flag;
    #endif

    #ifdef GL_SGIS_texture_lod
    extern GLboolean GL_SGIS_texture_lod_Flag;
    #endif

    #ifdef GL_SGIS_texture_lod_bias
    extern GLboolean GL_SGIS_texture_lod_bias_Flag;
    #endif

    #ifdef GL_SGIS_multitexture
    extern GLboolean GL_SGIS_multitexture_Flag;
    extern PFNGLSELECTTEXTURESGISPROC glSelectTextureSGIS;
    extern PFNGLSELECTTEXTURETRANSFORMSGISPROC glSelectTextureTransformSGIS;
    extern PFNGLSELECTTEXTURECOORDSETSGISPROC glSelectTextureCoordSetSGIS;
    extern PFNGLMULTITEXCOORD1DSGISPROC glMultiTexCoord1dSGIS;
    extern PFNGLMULTITEXCOORD1DVSGISPROC glMultiTexCoord1dvSGIS;
    extern PFNGLMULTITEXCOORD1FSGISPROC glMultiTexCoord1fSGIS;
    extern PFNGLMULTITEXCOORD1FVSGISPROC glMultiTexCoord1fvSGIS;
    extern PFNGLMULTITEXCOORD1ISGISPROC glMultiTexCoord1iSGIS;
    extern PFNGLMULTITEXCOORD1IVSGISPROC glMultiTexCoord1ivSGIS;
    extern PFNGLMULTITEXCOORD1SSGISPROC glMultiTexCoord1sSGIS;
    extern PFNGLMULTITEXCOORD1SVSGISPROC glMultiTexCoord1svSGIS;
    extern PFNGLMULTITEXCOORD2DSGISPROC glMultiTexCoord2dSGIS;
    extern PFNGLMULTITEXCOORD2DVSGISPROC glMultiTexCoord2dvSGIS;
    extern PFNGLMULTITEXCOORD2FSGISPROC glMultiTexCoord2fSGIS;
    extern PFNGLMULTITEXCOORD2FVSGISPROC glMultiTexCoord2fvSGIS;
    extern PFNGLMULTITEXCOORD2ISGISPROC glMultiTexCoord2iSGIS;
    extern PFNGLMULTITEXCOORD2IVSGISPROC glMultiTexCoord2ivSGIS;
    extern PFNGLMULTITEXCOORD2SSGISPROC glMultiTexCoord2sSGIS;
    extern PFNGLMULTITEXCOORD2SVSGISPROC glMultiTexCoord2svSGIS;
    extern PFNGLMULTITEXCOORD3DSGISPROC glMultiTexCoord3dSGIS;
    extern PFNGLMULTITEXCOORD3DVSGISPROC glMultiTexCoord3dvSGIS;
    extern PFNGLMULTITEXCOORD3FSGISPROC glMultiTexCoord3fSGIS;
    extern PFNGLMULTITEXCOORD3FVSGISPROC glMultiTexCoord3fvSGIS;
    extern PFNGLMULTITEXCOORD3ISGISPROC glMultiTexCoord3iSGIS;
    extern PFNGLMULTITEXCOORD3IVSGISPROC glMultiTexCoord3ivSGIS;
    extern PFNGLMULTITEXCOORD3SSGISPROC glMultiTexCoord3sSGIS;
    extern PFNGLMULTITEXCOORD3SVSGISPROC glMultiTexCoord3svSGIS;
    extern PFNGLMULTITEXCOORD4DSGISPROC glMultiTexCoord4dSGIS;
    extern PFNGLMULTITEXCOORD4DVSGISPROC glMultiTexCoord4dvSGIS;
    extern PFNGLMULTITEXCOORD4FSGISPROC glMultiTexCoord4fSGIS;
    extern PFNGLMULTITEXCOORD4FVSGISPROC glMultiTexCoord4fvSGIS;
    extern PFNGLMULTITEXCOORD4ISGISPROC glMultiTexCoord4iSGIS;
    extern PFNGLMULTITEXCOORD4IVSGISPROC glMultiTexCoord4ivSGIS;
    extern PFNGLMULTITEXCOORD4SSGISPROC glMultiTexCoord4sSGIS;
    extern PFNGLMULTITEXCOORD4SVSGISPROC glMultiTexCoord4svSGIS;
    extern PFNGLMULTITEXCOORD1DSGISPROC glMTexCoord1dSGIS;
    extern PFNGLMULTITEXCOORD1DVSGISPROC glMTexCoord1dvSGIS;
    extern PFNGLMULTITEXCOORD1FSGISPROC glMTexCoord1fSGIS;
    extern PFNGLMULTITEXCOORD1FVSGISPROC glMTexCoord1fvSGIS;
    extern PFNGLMULTITEXCOORD1ISGISPROC glMTexCoord1iSGIS;
    extern PFNGLMULTITEXCOORD1IVSGISPROC glMTexCoord1ivSGIS;
    extern PFNGLMULTITEXCOORD1SSGISPROC glMTexCoord1sSGIS;
    extern PFNGLMULTITEXCOORD1SVSGISPROC glMTexCoord1svSGIS;
    extern PFNGLMULTITEXCOORD2DSGISPROC glMTexCoord2dSGIS;
    extern PFNGLMULTITEXCOORD2DVSGISPROC glMTexCoord2dvSGIS;
    extern PFNGLMULTITEXCOORD2FSGISPROC glMTexCoord2fSGIS;
    extern PFNGLMULTITEXCOORD2FVSGISPROC glMTexCoord2fvSGIS;
    extern PFNGLMULTITEXCOORD2ISGISPROC glMTexCoord2iSGIS;
    extern PFNGLMULTITEXCOORD2IVSGISPROC glMTexCoord2ivSGIS;
    extern PFNGLMULTITEXCOORD2SSGISPROC glMTexCoord2sSGIS;
    extern PFNGLMULTITEXCOORD2SVSGISPROC glMTexCoord2svSGIS;
    extern PFNGLMULTITEXCOORD3DSGISPROC glMTexCoord3dSGIS;
    extern PFNGLMULTITEXCOORD3DVSGISPROC glMTexCoord3dvSGIS;
    extern PFNGLMULTITEXCOORD3FSGISPROC glMTexCoord3fSGIS;
    extern PFNGLMULTITEXCOORD3FVSGISPROC glMTexCoord3fvSGIS;
    extern PFNGLMULTITEXCOORD3ISGISPROC glMTexCoord3iSGIS;
    extern PFNGLMULTITEXCOORD3IVSGISPROC glMTexCoord3ivSGIS;
    extern PFNGLMULTITEXCOORD3SSGISPROC glMTexCoord3sSGIS;
    extern PFNGLMULTITEXCOORD3SVSGISPROC glMTexCoord3svSGIS;
    extern PFNGLMULTITEXCOORD4DSGISPROC glMTexCoord4dSGIS;
    extern PFNGLMULTITEXCOORD4DVSGISPROC glMTexCoord4dvSGIS;
    extern PFNGLMULTITEXCOORD4FSGISPROC glMTexCoord4fSGIS;
    extern PFNGLMULTITEXCOORD4FVSGISPROC glMTexCoord4fvSGIS;
    extern PFNGLMULTITEXCOORD4ISGISPROC glMTexCoord4iSGIS;
    extern PFNGLMULTITEXCOORD4IVSGISPROC glMTexCoord4ivSGIS;
    extern PFNGLMULTITEXCOORD4SSGISPROC glMTexCoord4sSGIS;
    extern PFNGLMULTITEXCOORD4SVSGISPROC glMTexCoord4svSGIS;
    #endif

    #ifdef GL_KTX_buffer_region
    extern GLboolean GL_KTX_buffer_region_Flag;
    extern PFNGLBUFFERREGIONENABLEDEXTPROC glBufferRegionEnabled;
    extern PFNGLNEWBUFFERREGIONEXTPROC glNewBufferRegion;
    extern PFNGLDELETEBUFFERREGIONEXTPROC glDeleteBufferRegion;
    extern PFNGLREADBUFFERREGIONEXTPROC glReadBufferRegion;
    extern PFNGLDRAWBUFFERREGIONEXTPROC glDrawBufferRegion;
    #endif

    #ifdef GL_WIN_swap_hint
    extern GLboolean GL_WIN_swap_hint_Flag;
    extern PFNGLADDSWAPHINTRECTWINPROC glAddSwapHintRectWIN;
    #endif

    #ifdef WGL_ARB_multisample
    extern GLboolean WGL_ARB_multisample_Flag;
    #endif

    #ifdef WGL_ARB_pixel_format
    extern GLboolean WGL_ARB_pixel_format_Flag;
    extern PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB;
    extern PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB;
    extern PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
    #endif

    #ifdef WGL_ARB_make_current_read
    extern GLboolean WGL_ARB_make_current_read_Flag;
    extern PFNWGLMAKECONTEXTCURRENTARBPROC wglMakeContextCurrentARB;
    extern PFNWGLGETCURRENTREADDCARBPROC wglGetCurrentReadDCARB;
    #endif

    #ifdef WGL_ARB_pbuffer
    extern GLboolean WGL_ARB_pbuffer_Flag;
    extern PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;
    extern PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB;
    extern PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB;
    extern PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB;
    extern PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB;
    #endif

    #ifdef WGL_ARB_extensions_string
    extern GLboolean WGL_ARB_extensions_string_Flag;
    extern PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
    #endif

    #ifdef WGL_EXT_extensions_string
    extern GLboolean WGL_EXT_extensions_string_Flag;
    extern PFNWGLGETEXTENSIONSSTRINGEXTPROC wglGetExtensionsStringEXT;
    #endif

    #ifdef WGL_EXT_swap_control
    extern GLboolean WGL_EXT_swap_control_Flag;
    extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
    extern PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT;
    #endif

    #ifdef WGL_ARB_render_texture
    extern GLboolean WGL_ARB_render_texture_Flag;
    extern PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB;
    extern PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB;
    extern PFNWGLSETPBUFFERATTRIBARBPROC wglSetPbufferAttribARB;
    #endif

    #ifdef WGL_ATI_pixel_format_float
    extern GLboolean WGL_ATI_pixel_format_float_Flag;
    #endif

    /* OpenGL 1.4 */
    #ifdef GL_EXT_multi_draw_arrays
    extern PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArrays;
    extern PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElements;
    #endif

    #ifdef GL_EXT_fog_coord
    extern PFNGLFOGCOORDFEXTPROC glFogCoordf;
    extern PFNGLFOGCOORDDEXTPROC glFogCoordd;
    extern PFNGLFOGCOORDFVEXTPROC glFogCoordfv;
    extern PFNGLFOGCOORDDVEXTPROC glFogCoorddv;
    extern PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer;
    #endif

    #if GL_EXT_point_parameters
    extern PFNGLPOINTPARAMETERFEXTPROC glPointParameterf;
    extern PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfv;
    #endif

    #ifdef GL_EXT_secondary_color
    extern PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3f;
    extern PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3d;
    extern PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3b;
    extern PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3s;
    extern PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3i;
    extern PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ub;
    extern PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3us;
    extern PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3ui;
    extern PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fv;
    extern PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dv;
    extern PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bv;
    extern PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3sv;
    extern PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3iv;
    extern PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubv;
    extern PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usv;
    extern PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uiv;
    extern PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointer;
    #endif

    #ifdef GL_EXT_blend_func_separate
    extern PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparate;
    #endif

    #ifdef GL_ARB_window_pos
    extern PFNGLWINDOWPOS2DARBPROC glWindowPos2d;
    extern PFNGLWINDOWPOS2FARBPROC glWindowPos2f;
    extern PFNGLWINDOWPOS2IARBPROC glWindowPos2i;
    extern PFNGLWINDOWPOS2SARBPROC glWindowPos2s;
    extern PFNGLWINDOWPOS2IVARBPROC glWindowPos2iv;
    extern PFNGLWINDOWPOS2SVARBPROC glWindowPos2sv;
    extern PFNGLWINDOWPOS2FVARBPROC glWindowPos2fv;
    extern PFNGLWINDOWPOS2DVARBPROC glWindowPos2dv;
    extern PFNGLWINDOWPOS3IARBPROC glWindowPos3i;
    extern PFNGLWINDOWPOS3SARBPROC glWindowPos3s;
    extern PFNGLWINDOWPOS3FARBPROC glWindowPos3f;
    extern PFNGLWINDOWPOS3DARBPROC glWindowPos3d;
    extern PFNGLWINDOWPOS3IVARBPROC glWindowPos3iv;
    extern PFNGLWINDOWPOS3SVARBPROC glWindowPos3sv;
    extern PFNGLWINDOWPOS3FVARBPROC glWindowPos3fv;
    extern PFNGLWINDOWPOS3DVARBPROC glWindowPos3dv;
    #endif

    /* OpenGL 1.3 */
    #ifdef GL_ARB_multitexture
    extern PFNGLACTIVETEXTUREARBPROC glActiveTexture;
    extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture;
    extern PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1d;
    extern PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dv;
    extern PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1f;
    extern PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fv;
    extern PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1i;
    extern PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1iv;
    extern PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1s;
    extern PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1sv;
    extern PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2d;
    extern PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dv;
    extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f;
    extern PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fv;
    extern PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2i;
    extern PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2iv;
    extern PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2s;
    extern PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2sv;
    extern PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3d;
    extern PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dv;
    extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f;
    extern PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fv;
    extern PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3i;
    extern PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3iv;
    extern PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3s;
    extern PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3sv;
    extern PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4d;
    extern PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dv;
    extern PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4f;
    extern PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fv;
    extern PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4i;
    extern PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4iv;
    extern PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4s;
    extern PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4sv;
    #endif

    #ifdef GL_ARB_texture_compression
    extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3D;
    extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2D;
    extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1D;
    extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3D;
    extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2D;
    extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1D;
    extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImage;
    #endif

    #ifdef GL_ARB_multisample
    extern PFNGLSAMPLECOVERAGEARBPROC glSampleCoverage;
    #endif

    #ifdef GL_ARB_transpose_matrix
    extern PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixf;
    extern PFNGLLOADTRANSPOSEMATRIXDARBPROC glLoadTransposeMatrixd;
    extern PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixf;
    extern PFNGLMULTTRANSPOSEMATRIXDARBPROC glMultTransposeMatrixd;
    #endif

    /* OpenGL 1.2 */
    #ifdef GL_EXT_texture3D
    extern PFNGLTEXIMAGE3DEXTPROC glTexImage3D;
    extern PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D;
    extern PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D;
    #endif

    #ifdef GL_EXT_draw_range_elements
    extern PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElements;
    #endif

    /* GLSL extensions */

    #ifdef GL_ARB_shader_objects
    extern GLboolean GL_ARB_shader_objects_Flag;
    extern PFNGLDELETEOBJECTARBPROC                     glDeleteObjectARB;
    extern PFNGLGETHANDLEARBPROC                        glGetHandleARB;
    extern PFNGLDETACHOBJECTARBPROC                     glDetachObjectARB;
    extern PFNGLCREATESHADEROBJECTARBPROC               glCreateShaderObjectARB;
    extern PFNGLSHADERSOURCEARBPROC                     glShaderSourceARB;
    extern PFNGLCOMPILESHADERARBPROC                    glCompileShaderARB;
    extern PFNGLCREATEPROGRAMOBJECTARBPROC              glCreateProgramObjectARB;
    extern PFNGLATTACHOBJECTARBPROC                     glAttachObjectARB;
    extern PFNGLLINKPROGRAMARBPROC                      glLinkProgramARB;
    extern PFNGLUSEPROGRAMOBJECTARBPROC                 glUseProgramObjectARB;
    extern PFNGLVALIDATEPROGRAMARBPROC                  glValidateProgramARB;
    extern PFNGLUNIFORM1FARBPROC                        glUniform1fARB;
    extern PFNGLUNIFORM2FARBPROC                        glUniform2fARB;
    extern PFNGLUNIFORM3FARBPROC                        glUniform3fARB;
    extern PFNGLUNIFORM4FARBPROC                        glUniform4fARB;
    extern PFNGLUNIFORM1IARBPROC                        glUniform1iARB;
    extern PFNGLUNIFORM2IARBPROC                        glUniform2iARB;
    extern PFNGLUNIFORM3IARBPROC                        glUniform3iARB;
    extern PFNGLUNIFORM4IARBPROC                        glUniform4iARB;
    extern PFNGLUNIFORM1FVARBPROC                       glUniform1fvARB;
    extern PFNGLUNIFORM2FVARBPROC                       glUniform2fvARB;
    extern PFNGLUNIFORM3FVARBPROC                       glUniform3fvARB;
    extern PFNGLUNIFORM4FVARBPROC                       glUniform4fvARB;
    extern PFNGLUNIFORM1IVARBPROC                       glUniform1ivARB;
    extern PFNGLUNIFORM2IVARBPROC                       glUniform2ivARB;
    extern PFNGLUNIFORM3IVARBPROC                       glUniform3ivARB;
    extern PFNGLUNIFORM4IVARBPROC                       glUniform4ivARB;
    extern PFNGLUNIFORMMATRIX2FVARBPROC                 glUniformMatrix2fvARB;
    extern PFNGLUNIFORMMATRIX3FVARBPROC                 glUniformMatrix3fvARB;
    extern PFNGLUNIFORMMATRIX4FVARBPROC                 glUniformMatrix4fvARB;
    extern PFNGLGETOBJECTPARAMETERFVARBPROC             glGetObjectParameterfvARB;
    extern PFNGLGETOBJECTPARAMETERIVARBPROC             glGetObjectParameterivARB;
    extern PFNGLGETINFOLOGARBPROC                       glGetInfoLogARB;
    extern PFNGLGETATTACHEDOBJECTSARBPROC               glGetAttachedObjectsARB;
    extern PFNGLGETUNIFORMLOCATIONARBPROC               glGetUniformLocationARB;
    extern PFNGLGETACTIVEUNIFORMARBPROC                 glGetActiveUniformARB;
    extern PFNGLGETUNIFORMFVARBPROC                     glGetUniformfvARB;
    extern PFNGLGETUNIFORMIVARBPROC                     glGetUniformivARB;
    extern PFNGLGETSHADERSOURCEARBPROC                  glGetShaderSourceARB;
    #endif // GL_ARB_shader_objects

    #ifdef GL_ARB_vertex_shader
    extern GLboolean GL_ARB_vertex_shader_Flag;
    extern PFNGLBINDATTRIBLOCATIONARBPROC               glBindAttribLocationARB;
    extern PFNGLGETACTIVEATTRIBARBPROC                  glGetActiveAttribARB;
    extern PFNGLGETATTRIBLOCATIONARBPROC                glGetAttribLocationARB;
    #endif // GL_ARB_vertex_shader

    #ifdef GL_ARB_fragment_shader
    extern GLboolean GL_ARB_fragment_shader_Flag;
    #endif // GL_ARB_fragment_shader

    /* Initialize GL 1.4 entrypoints */
    int SetupGL1_4();

    /* Initialize GL 1.3 entrypoints */
    int SetupGL1_3();

    /* Initialize GL 1.2 entrypoints */
    int SetupGL1_2();

    /* Initialize WGL extension entrypoints */
    int SetupWGLExtensions();

    /* Initialize ARB extension entrypoints */
    int SetupARBExtensions();

    /* Initialize EXT extension entrypoints */
    int SetupEXTExtensions();

    /* Initialize ATI extension entrypoints */
    int SetupATIExtensions();

    /* Initialize GLSL extension entrypoints */
    int SetupGLSLExtensions();

    int SetupExtensionsFromString(const char *);

    #ifdef __cplusplus
    } //extern C
    #endif

    #endif //__EXTSETUP_H__

    ¡¡

    file name: extsetup.c (downloaded)

    /*
    ** Copyright (C) 2002 ATI Technologies Inc.
    */

    #ifndef APIENTRY
    #ifdef WIN32
    #define WIN32_LEAN_AND_MEAN 1
    #include <windows.h>
    #endif
    #endif

    #include <stdlib.h>

    #include "extsetup.h"

    #ifdef GL_ARB_multisample
    GLboolean GL_ARB_multisample_Flag = GL_FALSE;
    PFNGLSAMPLECOVERAGEARBPROC glSampleCoverageARB = NULL;
    #endif

    #ifdef GL_ARB_multitexture
    GLboolean GL_ARB_multitexture_Flag = GL_FALSE;
    PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL;
    PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL;
    PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB = NULL;
    PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB = NULL;
    PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB = NULL;
    PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB = NULL;
    PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB = NULL;
    PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB = NULL;
    PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB = NULL;
    PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB = NULL;
    PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB = NULL;
    PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB = NULL;
    PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL;
    PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB = NULL;
    PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB = NULL;
    PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB = NULL;
    PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB = NULL;
    PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB = NULL;
    PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB = NULL;
    PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB = NULL;
    PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB = NULL;
    PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB = NULL;
    PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB = NULL;
    PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB = NULL;
    PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB = NULL;
    PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB = NULL;
    PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB = NULL;
    PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB = NULL;
    PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB = NULL;
    PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB = NULL;
    PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB = NULL;
    PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB = NULL;
    PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB = NULL;
    PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB = NULL;
    #endif

    #ifdef GL_ARB_texture_compression
    GLboolean GL_ARB_texture_compression_Flag = GL_FALSE;
    PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3DARB = NULL;
    PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2DARB = NULL;
    PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1DARB = NULL;
    PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3DARB = NULL;
    PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2DARB = NULL;
    PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1DARB = NULL;
    PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARB = NULL;
    #endif

    #ifdef GL_ARB_transpose_matrix
    GLboolean GL_ARB_transpose_matrix_Flag = GL_FALSE;
    PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixfARB = NULL;
    PFNGLLOADTRANSPOSEMATRIXDARBPROC glLoadTransposeMatrixdARB = NULL;
    PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixfARB = NULL;
    PFNGLMULTTRANSPOSEMATRIXDARBPROC glMultTransposeMatrixdARB = NULL;

    #endif

    #ifdef GL_ARB_vertex_blend
    GLboolean GL_ARB_vertex_blend_Flag = GL_FALSE;
    PFNGLWEIGHTBVARBPROC glWeightbvARB = NULL;
    PFNGLWEIGHTSVARBPROC glWeightsvARB = NULL;
    PFNGLWEIGHTIVARBPROC glWeightivARB = NULL;
    PFNGLWEIGHTFVARBPROC glWeightfvARB = NULL;
    PFNGLWEIGHTDVARBPROC glWeightdvARB = NULL;
    PFNGLWEIGHTUBVARBPROC glWeightubvARB = NULL;
    PFNGLWEIGHTUSVARBPROC glWeightusvARB = NULL;
    PFNGLWEIGHTUIVARBPROC glWeightuivARB = NULL;
    PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB = NULL;
    PFNGLVERTEXBLENDARBPROC glVertexBlendARB = NULL;
    #endif

    #ifdef GL_ARB_vertex_buffer_object
    GLboolean GL_ARB_vertex_buffer_object_flag = GL_FALSE;
    PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL;
    PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = NULL;
    PFNGLGENBUFFERSARBPROC glGenBuffersARB = NULL;
    PFNGLISBUFFERARBPROC glIsBufferARB = NULL;
    PFNGLBUFFERDATAARBPROC glBufferDataARB = NULL;
    PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB = NULL;
    PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB = NULL;
    PFNGLMAPBUFFERARBPROC glMapBufferARB = NULL;
    PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL;
    PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL;
    PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL;
    #endif

    #ifdef GL_ARB_window_pos
    GLboolean GL_ARB_window_pos_Flag = GL_FALSE;
    PFNGLWINDOWPOS2DARBPROC glWindowPos2dARB = NULL;
    PFNGLWINDOWPOS2FARBPROC glWindowPos2fARB = NULL;
    PFNGLWINDOWPOS2IARBPROC glWindowPos2iARB = NULL;
    PFNGLWINDOWPOS2SARBPROC glWindowPos2sARB = NULL;
    PFNGLWINDOWPOS2IVARBPROC glWindowPos2ivARB = NULL;
    PFNGLWINDOWPOS2SVARBPROC glWindowPos2svARB = NULL;
    PFNGLWINDOWPOS2FVARBPROC glWindowPos2fvARB = NULL;
    PFNGLWINDOWPOS2DVARBPROC glWindowPos2dvARB = NULL;
    PFNGLWINDOWPOS3IARBPROC glWindowPos3iARB = NULL;
    PFNGLWINDOWPOS3SARBPROC glWindowPos3sARB = NULL;
    PFNGLWINDOWPOS3FARBPROC glWindowPos3fARB = NULL;
    PFNGLWINDOWPOS3DARBPROC glWindowPos3dARB = NULL;
    PFNGLWINDOWPOS3IVARBPROC glWindowPos3ivARB = NULL;
    PFNGLWINDOWPOS3SVARBPROC glWindowPos3svARB = NULL;
    PFNGLWINDOWPOS3FVARBPROC glWindowPos3fvARB = NULL;
    PFNGLWINDOWPOS3DVARBPROC glWindowPos3dvARB = NULL;
    #endif

    #ifdef GL_ARB_vertex_program
    GLboolean GL_ARB_vertex_program_Flag = GL_FALSE;
    PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB = NULL;
    PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL;
    PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL;
    PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB = NULL;
    PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB = NULL;
    PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB = NULL;
    PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL;
    PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL;
    PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB = NULL;
    PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB = NULL;
    PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB = NULL;
    PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL;
    PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB = NULL;
    PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB = NULL;
    PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB = NULL;
    PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL;
    PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB = NULL;
    PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB = NULL;
    PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB = NULL;
    PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL;
    PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL;
    PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB = NULL;
    PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB = NULL;
    PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB = NULL;
    PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL;
    PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB = NULL;
    PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL;
    PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB = NULL;
    PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB = NULL;
    PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB = NULL;
    PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB = NULL;
    PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB = NULL;
    PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB = NULL;
    PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB = NULL;
    PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB = NULL;
    PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB = NULL;
    PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB = NULL;
    PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB = NULL;
    PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB = NULL;
    PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL;
    PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL;
    PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = NULL;
    PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL;
    PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB = NULL;
    PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB = NULL;
    PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL;
    PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB = NULL;
    PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB = NULL;
    PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB = NULL;
    PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB = NULL;;
    PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB = NULL;;
    PFNGLGETPROGRAMIVARBPROC glGetProgramivARB = NULL;;
    PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB = NULL;
    PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB = NULL;
    PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL;
    PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL;
    PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL;
    PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
    #endif

    #ifdef GL_ARB_fragment_program
    GLboolean GL_ARB_fragment_program_Flag = GL_FALSE;
    #ifndef GL_ARB_vertex_program
    PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL;
    PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL;
    PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = NULL;
    PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL;
    PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB = NULL;
    PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB = NULL;
    PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL;
    PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB = NULL;
    PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB = NULL;
    PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB = NULL;
    PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetssProgramEnvParameterfvARB = NULL;
    PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB = NULL;;
    PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB = NULL;;
    PFNGLGETPROGRAMIVARBPROC glGetProgramivARB = NULL;;
    PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB = NULL;;
    PFNGLISPROGRAMARBPROC glIsProgramARB = NULL;
    #endif
    #endif

    #ifdef GL_ARB_depth_texture
    GLboolean GL_ARB_depth_texture_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_shadow
    GLboolean GL_ARB_shadow_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_shadow_ambient
    GLboolean GL_ARB_shadow_ambient_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_border_clamp
    GLboolean GL_ARB_texture_border_clamp_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_mirror_repeat
    GLboolean GL_ARB_texture_mirror_repeat_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_cube_map
    GLboolean GL_ARB_texture_cube_map_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_env_add
    GLboolean GL_ARB_texture_env_add_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_env_combine
    GLboolean GL_ARB_texture_env_combine_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_env_crossbar
    GLboolean GL_ARB_texture_env_crossbar_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_texture_env_dot3
    GLboolean GL_ARB_texture_env_dot3_Flag = GL_FALSE;
    #endif

    #ifdef GL_ARB_point_sprite
    GLboolean GL_ARB_point_sprite_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_vertex_array
    GLboolean GL_EXT_vertex_array_Flag = GL_FALSE;
    PFNGLARRAYELEMENTEXTPROC glArrayElementEXT = NULL;
    PFNGLDRAWARRAYSEXTPROC glDrawArraysEXT = NULL;
    PFNGLVERTEXPOINTEREXTPROC glVertexPointerEXT = NULL;
    PFNGLNORMALPOINTEREXTPROC glNormalPointerEXT = NULL;
    PFNGLCOLORPOINTEREXTPROC glColorPointerEXT = NULL;
    PFNGLINDEXPOINTEREXTPROC glIndexPointerEXT = NULL;
    PFNGLTEXCOORDPOINTEREXTPROC glTexCoordPointerEXT = NULL;
    PFNGLEDGEFLAGPOINTEREXTPROC glEdgeFlagPointerEXT = NULL;
    PFNGLGETPOINTERVEXTPROC glGetPointervEXT = NULL;
    #endif

    #ifdef GL_EXT_compiled_vertex_array
    GLboolean GL_EXT_compiled_vertex_array_Flag = GL_FALSE;
    PFNGLLOCKARRAYSEXTPROC glLockArraysEXT = NULL;
    PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT = NULL;
    #endif

    #ifdef GL_EXT_texture_object
    GLboolean GL_EXT_texture_object_Flag = GL_FALSE;
    PFNGLGENTEXTURESEXTPROC glGenTexturesEXT = NULL;
    PFNGLDELETETEXTURESEXTPROC glDeleteTexturesEXT = NULL;
    PFNGLBINDTEXTUREEXTPROC glBindTextureEXT = NULL;
    PFNGLPRIORITIZETEXTURESEXTPROC glPrioritizeTexturesEXT = NULL;
    PFNGLARETEXTURESRESIDENTEXTPROC glAreTexturesResidentEXT = NULL;
    PFNGLISTEXTUREEXTPROC glIsTextureEXT = NULL;
    #endif

    #ifdef GL_EXT_fog_coord
    GLboolean GL_EXT_fog_coord_Flag = GL_FALSE;
    PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = NULL;
    PFNGLFOGCOORDDEXTPROC glFogCoorddEXT = NULL;
    PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT = NULL;
    PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = NULL;
    PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = NULL;
    #endif

    #ifdef GL_EXT_secondary_color
    GLboolean GL_EXT_secondary_color_Flag = GL_FALSE;
    PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3fEXT = NULL;
    PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3dEXT = NULL;
    PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3bEXT = NULL;
    PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3sEXT = NULL;
    PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3iEXT = NULL;
    PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ubEXT = NULL;
    PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3usEXT = NULL;
    PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3uiEXT = NULL;
    PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXT = NULL;
    PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dvEXT = NULL;
    PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bvEXT = NULL;
    PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3svEXT = NULL;
    PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3ivEXT = NULL;
    PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXT = NULL;
    PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usvEXT = NULL;
    PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uivEXT = NULL;
    PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointerEXT = NULL;
    #endif

    #ifdef GL_EXT_draw_range_elements
    GLboolean GL_EXT_draw_range_elements_Flag = GL_FALSE;
    PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElementsEXT = NULL;
    #endif

    #ifdef GL_EXT_multi_draw_arrays
    GLboolean GL_EXT_multi_draw_arrays_Flag = GL_FALSE;
    PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArraysEXT = NULL;
    PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElementsEXT = NULL;
    #endif

    #ifdef GL_EXT_texture3D
    GLboolean GL_EXT_texture3D_Flag = GL_FALSE;
    PFNGLTEXIMAGE3DEXTPROC glTexImage3DEXT = NULL;
    PFNGLTEXSUBIMAGE3DPROC glTexSubImage3DEXT = NULL;
    PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3DEXT = NULL;
    #endif

    #ifdef GL_EXT_point_parameters
    GLboolean GL_EXT_point_parameters_Flag = GL_FALSE;
    PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = NULL;
    PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = NULL;
    #endif

    #ifdef GL_ARB_point_parameters
    GLboolean GL_ARB_point_parameters_Flag = GL_FALSE;
    PFNGLPOINTPARAMETERFEXTPROC glPointParameterfARB = NULL;
    PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvARB = NULL;
    #endif

    #ifdef GL_EXT_vertex_shader
    GLboolean GL_EXT_vertex_shader_Flag = GL_FALSE;
    PFNGLBEGINVERTEXSHADEREXTPROC glBeginVertexShaderEXT = NULL;
    PFNGLENDVERTEXSHADEREXTPROC glEndVertexShaderEXT = NULL;
    PFNGLBINDVERTEXSHADEREXTPROC glBindVertexShaderEXT = NULL;
    PFNGLGENVERTEXSHADERSEXTPROC glGenVertexShadersEXT = NULL;
    PFNGLDELETEVERTEXSHADEREXTPROC glDeleteVertexShaderEXT = NULL;
    PFNGLSHADEROP1EXTPROC glShaderOp1EXT = NULL;
    PFNGLSHADEROP2EXTPROC glShaderOp2EXT = NULL;
    PFNGLSHADEROP3EXTPROC glShaderOp3EXT = NULL;
    PFNGLSWIZZLEEXTPROC glSwizzleEXT = NULL;
    PFNGLWRITEMASKEXTPROC glWriteMaskEXT = NULL;
    PFNGLINSERTCOMPONENTEXTPROC glInsertComponentEXT = NULL;
    PFNGLEXTRACTCOMPONENTEXTPROC glExtractComponentEXT = NULL;
    PFNGLGENSYMBOLSEXTPROC glGenSymbolsEXT = NULL;
    PFNGLSETINVARIANTEXTPROC glSetInvariantEXT = NULL;
    PFNGLSETLOCALCONSTANTEXTPROC glSetLocalConstantEXT = NULL;
    PFNGLVARIANTBVEXTPROC glVariantbvEXT = NULL;
    PFNGLVARIANTSVEXTPROC glVariantsvEXT = NULL;
    PFNGLVARIANTIVEXTPROC glVariantivEXT = NULL;
    PFNGLVARIANTFVEXTPROC glVariantfvEXT = NULL;
    PFNGLVARIANTDVEXTPROC glVariantdvEXT = NULL;
    PFNGLVARIANTUBVEXTPROC glVariantubvEXT = NULL;
    PFNGLVARIANTUSVEXTPROC glVariantusvEXT = NULL;
    PFNGLVARIANTUIVEXTPROC glVariantuivEXT = NULL;
    PFNGLVARIANTPOINTEREXTPROC glVariantPointerEXT = NULL;
    PFNGLENABLEVARIANTCLIENTSTATEEXTPROC glEnableVariantClientStateEXT = NULL;
    PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC glDisableVariantClientStateEXT = NULL;
    PFNGLBINDLIGHTPARAMETEREXTPROC glBindLightParameterEXT = NULL;
    PFNGLBINDMATERIALPARAMETEREXTPROC glBindMaterialParameterEXT = NULL;
    PFNGLBINDTEXGENPARAMETEREXTPROC glBindTexGenParameterEXT = NULL;
    PFNGLBINDTEXTUREUNITPARAMETEREXTPROC glBindTextureUnitParameterEXT = NULL;
    PFNGLBINDPARAMETEREXTPROC glBindParameterEXT = NULL;
    PFNGLISVARIANTENABLEDEXTPROC glIsVariantEnabledEXT = NULL;
    PFNGLGETVARIANTBOOLEANVEXTPROC glGetVariantBooleanvEXT = NULL;
    PFNGLGETVARIANTINTEGERVEXTPROC glGetVariantIntegervEXT = NULL;
    PFNGLGETVARIANTFLOATVEXTPROC glGetVariantFloatvEXT = NULL;
    PFNGLGETVARIANTPOINTERVEXTPROC glGetVariantPointervEXT = NULL;
    PFNGLGETINVARIANTBOOLEANVEXTPROC glGetInvariantBooleanvEXT = NULL;
    PFNGLGETINVARIANTINTEGERVEXTPROC glGetInvariantIntegervEXT = NULL;
    PFNGLGETINVARIANTFLOATVEXTPROC glGetInvariantFloatvEXT = NULL;
    PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC glGetLocalConstantBooleanvEXT = NULL;
    PFNGLGETLOCALCONSTANTINTEGERVEXTPROC glGetLocalConstantIntegervEXT = NULL;
    PFNGLGETLOCALCONSTANTFLOATVEXTPROC glGetLocalConstantFloatvEXT = NULL;
    #endif

    #ifdef GL_EXT_blend_minmax
    GLboolean GL_EXT_blend_minmax_Flag = GL_FALSE;
    PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT = NULL;
    #endif

    #ifdef GL_EXT_blend_func_separate
    GLboolean GL_EXT_blend_func_separate_Flag = GL_FALSE;
    PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL;
    #endif

    #ifdef GL_EXT_blend_color
    GLboolean GL_EXT_blend_color_Flag = GL_FALSE;
    PFNGLBLENDCOLOREXTPROC glBlendColorEXT = NULL;
    #endif

    #ifdef GL_EXT_abgr
    GLboolean GL_EXT_abgr_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_bgra
    GLboolean GL_EXT_bgra_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_blend_subtract
    GLboolean GL_EXT_blend_subtract_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_clip_volume_hint
    GLboolean GL_EXT_clip_volume_hint_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_packed_pixels
    GLboolean GL_EXT_packed_pixels_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_rescale_normal
    GLboolean GL_EXT_rescale_normal_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_separate_specular_color
    GLboolean GL_EXT_separate_specular_color_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texgen_reflection
    GLboolean GL_EXT_texgen_reflection_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_cube_map
    GLboolean GL_EXT_texture_cube_map_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_compression_s3tc
    GLboolean GL_EXT_texture_compression_s3tc_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_edge_clamp
    GLboolean GL_EXT_texture_edge_clamp_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_env_add
    GLboolean GL_EXT_texture_env_add_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_env_combine
    GLboolean GL_EXT_texture_env_combine_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_env_dot3
    GLboolean GL_EXT_texture_env_dot3_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_filter_anisotropic
    GLboolean GL_EXT_texture_filter_anisotropic_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_stencil_wrap
    GLboolean GL_EXT_stencil_wrap_Flag = GL_FALSE;
    #endif

    #ifdef GL_EXT_texture_rectangle
    GLboolean GL_EXT_texture_rectangle_Flag = GL_FALSE;
    #endif

    #ifdef GL_ATI_envmap_bumpmap
    GLboolean GL_ATI_envmap_bumpmap_Flag = GL_FALSE;
    PFNGLTEXBUMPPARAMETERIVATIPROC glTexBumpParameterivATI = NULL;
    PFNGLTEXBUMPPARAMETERFVATIPROC glTexBumpParameterfvATI = NULL;
    PFNGLGETTEXBUMPPARAMETERIVATIPROC glGetTexBumpParameterivATI = NULL;
    PFNGLGETTEXBUMPPARAMETERFVATIPROC glGetTexBumpParameterfvATI = NULL;
    #endif

    #ifdef GL_ATI_fragment_shader
    GLboolean GL_ATI_fragment_shader_Flag = GL_FALSE;
    PFNGLGENFRAGMENTSHADERSATIPROC glGenFragmentShadersATI = NULL;
    PFNGLBINDFRAGMENTSHADERATIPROC glBindFragmentShaderATI = NULL;
    PFNGLDELETEFRAGMENTSHADERATIPROC glDeleteFragmentShaderATI = NULL;
    PFNGLBEGINFRAGMENTSHADERATIPROC glBeginFragmentShaderATI = NULL;
    PFNGLENDFRAGMENTSHADERATIPROC glEndFragmentShaderATI = NULL;
    PFNGLPASSTEXCOORDATIPROC glPassTexCoordATI = NULL;
    PFNGLSAMPLEMAPATIPROC glSampleMapATI = NULL;
    PFNGLCOLORFRAGMENTOP1ATIPROC glColorFragmentOp1ATI = NULL;
    PFNGLCOLORFRAGMENTOP2ATIPROC glColorFragmentOp2ATI = NULL;
    PFNGLCOLORFRAGMENTOP3ATIPROC glColorFragmentOp3ATI = NULL;
    PFNGLALPHAFRAGMENTOP1ATIPROC glAlphaFragmentOp1ATI = NULL;
    PFNGLALPHAFRAGMENTOP2ATIPROC glAlphaFragmentOp2ATI = NULL;
    PFNGLALPHAFRAGMENTOP3ATIPROC glAlphaFragmentOp3ATI = NULL;
    PFNGLSETFRAGMENTSHADERCONSTANTATIPROC glSetFragmentShaderConstantATI = NULL;
    #endif

    #ifdef GL_ATI_vertex_array_object
    GLboolean GL_ATI_vertex_array_object_Flag = GL_FALSE;
    PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI = NULL;
    PFNGLISOBJECTBUFFERATIPROC glIsObjectBufferATI = NULL;
    PFNGLUPDATEOBJECTBUFFERATIPROC glUpdateObjectBufferATI = NULL;
    PFNGLGETOBJECTBUFFERFVATIPROC glGetObjectBufferfvATI = NULL;
    PFNGLGETOBJECTBUFFERIVATIPROC glGetObjectBufferivATI = NULL;
    PFNGLFREEOBJECTBUFFERATIPROC glFreeObjectBufferATI = NULL;
    PFNGLARRAYOBJECTATIPROC glArrayObjectATI = NULL;
    PFNGLGETARRAYOBJECTFVATIPROC glGetArrayObjectfvATI = NULL;
    PFNGLGETARRAYOBJECTIVATIPROC glGetArrayObjectivATI = NULL;
    PFNGLVARIANTARRAYOBJECTATIPROC glVariantArrayObjectATI = NULL;
    PFNGLGETVARIANTARRAYOBJECTFVATIPROC glGetVariantArrayObjectfvATI = NULL;
    PFNGLGETVARIANTARRAYOBJECTIVATIPROC glGetVariantArrayObjectivATI = NULL;
    #endif

    #ifdef GL_ATI_element_array
    GLboolean GL_ATI_element_array_Flag = GL_FALSE;
    PFNGLELEMENTPOINTERATIPROC glElementPointerATI = NULL;
    PFNGLDRAWELEMENTARRAYATIPROC glDrawElementArrayATI = NULL;
    PFNGLDRAWRANGEELEMENTARRAYATIPROC glDrawRangeElementArrayATI = NULL;
    #endif

    #ifdef GL_ATI_vertex_attrib_array_object
    GLboolean GL_ATI_vertex_attrib_array_object_Flag = GL_FALSE;
    PFNGLVERTEXATTRIBARRAYOBJECTATIPROC glVertexAttribArrayObjectATI = NULL;
    PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC glVertexAttribArrayObjectfvATI = NULL;
    PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC glVertexAttribArrayObjectivATI = NULL;
    #endif

    #ifdef GL_ATI_pn_triangles
    GLboolean GL_ATI_pn_triangles_Flag = GL_FALSE;
    PFNGLPNTRIANGLESIATIPROC glPNTrianglesiATI = NULL;
    PFNGLPNTRIANGLESFATIPROC glPNTrianglesfATI = NULL;
    #endif

    #ifdef GL_ATI_vertex_streams
    GLboolean GL_ATI_vertex_streams_Flag = GL_FALSE;
    PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC glClientActiveVertexStreamATI = NULL;
    PFNGLVERTEXBLENDENVIATIPROC glVertexBlendEnviATI = NULL;
    PFNGLVERTEXBLENDENVFATIPROC glVertexBlendEnvfATI = NULL;
    PFNGLVERTEXSTREAM2SATIPROC glVertexStream2sATI = NULL;
    PFNGLVERTEXSTREAM2SVATIPROC glVertexStream2svATI = NULL;
    PFNGLVERTEXSTREAM2IATIPROC glVertexStream2iATI = NULL;
    PFNGLVERTEXSTREAM2IVATIPROC glVertexStream2ivATI = NULL;
    PFNGLVERTEXSTREAM2FATIPROC glVertexStream2fATI = NULL;
    PFNGLVERTEXSTREAM2FVATIPROC glVertexStream2fvATI = NULL;
    PFNGLVERTEXSTREAM2DATIPROC glVertexStream2dATI = NULL;
    PFNGLVERTEXSTREAM2DVATIPROC glVertexStream2dvATI = NULL;
    PFNGLVERTEXSTREAM3SATIPROC glVertexStream3sATI = NULL;
    PFNGLVERTEXSTREAM3SVATIPROC glVertexStream3svATI = NULL;
    PFNGLVERTEXSTREAM3IATIPROC glVertexStream3iATI = NULL;
    PFNGLVERTEXSTREAM3IVATIPROC glVertexStream3ivATI = NULL;
    PFNGLVERTEXSTREAM3FATIPROC glVertexStream3fATI = NULL;
    PFNGLVERTEXSTREAM3FVATIPROC glVertexStream3fvATI = NULL;
    PFNGLVERTEXSTREAM3DATIPROC glVertexStream3dATI = NULL;
    PFNGLVERTEXSTREAM3DVATIPROC glVertexStream3dvATI = NULL;
    PFNGLVERTEXSTREAM4SATIPROC glVertexStream4sATI = NULL;
    PFNGLVERTEXSTREAM4SVATIPROC glVertexStream4svATI = NULL;
    PFNGLVERTEXSTREAM4IATIPROC glVertexStream4iATI = NULL;
    PFNGLVERTEXSTREAM4IVATIPROC glVertexStream4ivATI = NULL;
    PFNGLVERTEXSTREAM4FATIPROC glVertexStream4fATI = NULL;
    PFNGLVERTEXSTREAM4FVATIPROC glVertexStream4fvATI = NULL;
    PFNGLVERTEXSTREAM4DATIPROC glVertexStream4dATI = NULL;
    PFNGLVERTEXSTREAM4DVATIPROC glVertexStream4dvATI = NULL;
    PFNGLNORMALSTREAM3BATIPROC glNormalStream3bATI = NULL;
    PFNGLNORMALSTREAM3BVATIPROC glNormalStream3bvATI = NULL;
    PFNGLNORMALSTREAM3SATIPROC glNormalStream3sATI = NULL;
    PFNGLNORMALSTREAM3SVATIPROC glNormalStream3svATI = NULL;
    PFNGLNORMALSTREAM3IATIPROC glNormalStream3iATI = NULL;
    PFNGLNORMALSTREAM3IVATIPROC glNormalStream3ivATI = NULL;
    PFNGLNORMALSTREAM3FATIPROC glNormalStream3fATI = NULL;
    PFNGLNORMALSTREAM3FVATIPROC glNormalStream3fvATI = NULL;
    PFNGLNORMALSTREAM3DATIPROC glNormalStream3dATI = NULL;
    PFNGLNORMALSTREAM3DVATIPROC glNormalStream3dvATI = NULL;
    #endif

    #ifdef GL_ATI_separate_stencil
    GLboolean GL_ATI_separate_stencil_Flag = GL_FALSE;
    PFNGLSTENCILOPSEPARATEATIPROC glStencilOpSeparateATI = NULL;
    PFNGLSTENCILFUNCSEPARATEATIPROC glStencilFuncSeparateATI = NULL;
    #endif

    #ifdef GL_ATI_draw_buffers
    GLboolean GL_ATI_draw_buffers_Flag = GL_FALSE;
    PFNGLDRAWBUFFERSATIPROC glDrawBuffersATI = NULL;
    #endif

    #ifdef GL_ATI_texture_mirror_once
    GLboolean GL_ATI_texture_mirror_once_Flag = GL_FALSE;
    #endif

    #ifdef GL_ATI_texture_float
    GLboolean GL_ATI_texture_float_Flag = GL_FALSE;
    #endif

    #ifdef GL_ATI_texture_env_combine3
    GLboolean GL_ATI_texture_env_combine3_Flag = GL_FALSE;
    #endif

    #ifdef GL_ATIX_texture_env_route
    GLboolean GL_ATIX_texture_env_route_Flag = GL_FALSE;
    #endif

    #ifdef GL_ATIX_vertex_shader_output_point_size
    GLboolean GL_ATIX_vertex_shader_output_point_size_Flag = GL_FALSE;
    #endif

    #ifdef GL_NV_texgen_reflection
    GLboolean GL_NV_texgen_reflection_Flag = GL_FALSE;
    #endif

    #ifdef GL_NV_blend_square
    GLboolean GL_NV_blend_square_Flag = GL_FALSE;
    #endif

    #ifdef GL_NV_point_sprite
    GLboolean GL_NV_point_sprite_Flag = GL_FALSE;
    PFNGLPOINTPARAMETERINVPROC glPointParameteriNV = NULL;
    PFNGLPOINTPARAMETERIVNVPROC glPointParameterivNV = NULL;
    #endif

    #ifdef GL_ARB_occlusion_query
    GLboolean GL_ARB_occlusion_query_Flag = GL_FALSE;
    PFNGLGENQUERIESARBPROC        glGenQueriesARB        = NULL;
    PFNGLDELETEQUERIESARBPROC     glDeleteQueriesARB     = NULL;
    PFNGLISQUERYARBPROC           glIsQueryARB           = NULL;
    PFNGLBEGINQUERYARBPROC        glBeginQueryARB        = NULL;
    PFNGLENDQUERYARBPROC          glEndQueryARB          = NULL;
    PFNGLGETQUERYIVARBPROC        glGetQueryivARB        = NULL;
    PFNGLGETQUERYOBJECTIVARBPROC  glGetQueryObjectivARB  = NULL;
    PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL;

    #endif		// Updated by @RG for accomodating ARB Occlusion query.

    #ifdef GL_NV_occlusion_query
    GLboolean GL_NV_occlusion_query_Flag = GL_FALSE;
    PFNGLGENOCCLUSIONQUERIESNVPROC glGenOcclusionQueriesNV = NULL;
    PFNGLDELETEOCCLUSIONQUERIESNVPROC glDeleteOcclusionQueriesNV = NULL;
    PFNGLISOCCLUSIONQUERYNVPROC glIsOcclusionQueryNV = NULL;
    PFNGLBEGINOCCLUSIONQUERYNVPROC glBeginOcclusionQueryNV = NULL;
    PFNGLENDOCCLUSIONQUERYNVPROC glEndOcclusionQueryNV = NULL;
    PFNGLGETOCCLUSIONQUERYIVNVPROC glGetOcclusionQueryivNV = NULL;
    PFNGLGETOCCLUSIONQUERYUIVNVPROC glGetOcclusionQueryuivNV = NULL;
    #endif

    #ifdef GL_HP_occlusion_test
    GLboolean GL_HP_occlusion_test_Flag = GL_FALSE;
    #endif

    #ifdef GL_S3_s3tc
    GLboolean GL_S3_s3tc_Flag = GL_FALSE;
    #endif

    #ifdef GL_SGI_texture_edge_clamp
    GLboolean GL_SGI_texture_edge_clamp_Flag = GL_FALSE;
    #endif

    #ifdef GL_SGIS_generate_mipmap
    GLboolean GL_SGIS_generate_mipmap_Flag = GL_FALSE;
    #endif

    #ifdef GL_SGIS_texture_border_clamp
    GLboolean GL_SGIS_texture_border_clamp_Flag = GL_FALSE;
    #endif

    #ifdef GL_SGIS_texture_lod
    GLboolean GL_SGIS_texture_lod_Flag = GL_FALSE;
    #endif

    #ifdef GL_SGIS_texture_lod_bias
    GLboolean GL_SGIS_texture_lod_bias_Flag = GL_FALSE;
    #endif

    #ifdef GL_SGIS_multitexture
    GLboolean GL_SGIS_multitexture_Flag = GL_FALSE;
    PFNGLSELECTTEXTURESGISPROC glSelectTextureSGIS = NULL;
    PFNGLSELECTTEXTURETRANSFORMSGISPROC glSelectTextureTransformSGIS = NULL;
    PFNGLSELECTTEXTURECOORDSETSGISPROC glSelectTextureCoordSetSGIS = NULL;
    PFNGLMULTITEXCOORD1DSGISPROC glMultiTexCoord1dSGIS = NULL;
    PFNGLMULTITEXCOORD1DVSGISPROC glMultiTexCoord1dvSGIS = NULL;
    PFNGLMULTITEXCOORD1FSGISPROC glMultiTexCoord1fSGIS = NULL;
    PFNGLMULTITEXCOORD1FVSGISPROC glMultiTexCoord1fvSGIS = NULL;
    PFNGLMULTITEXCOORD1ISGISPROC glMultiTexCoord1iSGIS = NULL;
    PFNGLMULTITEXCOORD1IVSGISPROC glMultiTexCoord1ivSGIS = NULL;
    PFNGLMULTITEXCOORD1SSGISPROC glMultiTexCoord1sSGIS = NULL;
    PFNGLMULTITEXCOORD1SVSGISPROC glMultiTexCoord1svSGIS = NULL;
    PFNGLMULTITEXCOORD2DSGISPROC glMultiTexCoord2dSGIS = NULL;
    PFNGLMULTITEXCOORD2DVSGISPROC glMultiTexCoord2dvSGIS = NULL;
    PFNGLMULTITEXCOORD2FSGISPROC glMultiTexCoord2fSGIS = NULL;
    PFNGLMULTITEXCOORD2FVSGISPROC glMultiTexCoord2fvSGIS = NULL;
    PFNGLMULTITEXCOORD2ISGISPROC glMultiTexCoord2iSGIS = NULL;
    PFNGLMULTITEXCOORD2IVSGISPROC glMultiTexCoord2ivSGIS = NULL;
    PFNGLMULTITEXCOORD2SSGISPROC glMultiTexCoord2sSGIS = NULL;
    PFNGLMULTITEXCOORD2SVSGISPROC glMultiTexCoord2svSGIS = NULL;
    PFNGLMULTITEXCOORD3DSGISPROC glMultiTexCoord3dSGIS = NULL;
    PFNGLMULTITEXCOORD3DVSGISPROC glMultiTexCoord3dvSGIS = NULL;
    PFNGLMULTITEXCOORD3FSGISPROC glMultiTexCoord3fSGIS = NULL;
    PFNGLMULTITEXCOORD3FVSGISPROC glMultiTexCoord3fvSGIS = NULL;
    PFNGLMULTITEXCOORD3ISGISPROC glMultiTexCoord3iSGIS = NULL;
    PFNGLMULTITEXCOORD3IVSGISPROC glMultiTexCoord3ivSGIS = NULL;
    PFNGLMULTITEXCOORD3SSGISPROC glMultiTexCoord3sSGIS = NULL;
    PFNGLMULTITEXCOORD3SVSGISPROC glMultiTexCoord3svSGIS = NULL;
    PFNGLMULTITEXCOORD4DSGISPROC glMultiTexCoord4dSGIS = NULL;
    PFNGLMULTITEXCOORD4DVSGISPROC glMultiTexCoord4dvSGIS = NULL;
    PFNGLMULTITEXCOORD4FSGISPROC glMultiTexCoord4fSGIS = NULL;
    PFNGLMULTITEXCOORD4FVSGISPROC glMultiTexCoord4fvSGIS = NULL;
    PFNGLMULTITEXCOORD4ISGISPROC glMultiTexCoord4iSGIS = NULL;
    PFNGLMULTITEXCOORD4IVSGISPROC glMultiTexCoord4ivSGIS = NULL;
    PFNGLMULTITEXCOORD4SSGISPROC glMultiTexCoord4sSGIS = NULL;
    PFNGLMULTITEXCOORD4SVSGISPROC glMultiTexCoord4svSGIS = NULL;
    PFNGLMULTITEXCOORD1DSGISPROC glMTexCoord1dSGIS = NULL;
    PFNGLMULTITEXCOORD1DVSGISPROC glMTexCoord1dvSGIS = NULL;
    PFNGLMULTITEXCOORD1FSGISPROC glMTexCoord1fSGIS = NULL;
    PFNGLMULTITEXCOORD1FVSGISPROC glMTexCoord1fvSGIS = NULL;
    PFNGLMULTITEXCOORD1ISGISPROC glMTexCoord1iSGIS = NULL;
    PFNGLMULTITEXCOORD1IVSGISPROC glMTexCoord1ivSGIS = NULL;
    PFNGLMULTITEXCOORD1SSGISPROC glMTexCoord1sSGIS = NULL;
    PFNGLMULTITEXCOORD1SVSGISPROC glMTexCoord1svSGIS = NULL;
    PFNGLMULTITEXCOORD2DSGISPROC glMTexCoord2dSGIS = NULL;
    PFNGLMULTITEXCOORD2DVSGISPROC glMTexCoord2dvSGIS = NULL;
    PFNGLMULTITEXCOORD2FSGISPROC glMTexCoord2fSGIS = NULL;
    PFNGLMULTITEXCOORD2FVSGISPROC glMTexCoord2fvSGIS = NULL;
    PFNGLMULTITEXCOORD2ISGISPROC glMTexCoord2iSGIS = NULL;
    PFNGLMULTITEXCOORD2IVSGISPROC glMTexCoord2ivSGIS = NULL;
    PFNGLMULTITEXCOORD2SSGISPROC glMTexCoord2sSGIS = NULL;
    PFNGLMULTITEXCOORD2SVSGISPROC glMTexCoord2svSGIS = NULL;
    PFNGLMULTITEXCOORD3DSGISPROC glMTexCoord3dSGIS = NULL;
    PFNGLMULTITEXCOORD3DVSGISPROC glMTexCoord3dvSGIS = NULL;
    PFNGLMULTITEXCOORD3FSGISPROC glMTexCoord3fSGIS = NULL;
    PFNGLMULTITEXCOORD3FVSGISPROC glMTexCoord3fvSGIS = NULL;
    PFNGLMULTITEXCOORD3ISGISPROC glMTexCoord3iSGIS = NULL;
    PFNGLMULTITEXCOORD3IVSGISPROC glMTexCoord3ivSGIS = NULL;
    PFNGLMULTITEXCOORD3SSGISPROC glMTexCoord3sSGIS = NULL;
    PFNGLMULTITEXCOORD3SVSGISPROC glMTexCoord3svSGIS = NULL;
    PFNGLMULTITEXCOORD4DSGISPROC glMTexCoord4dSGIS = NULL;
    PFNGLMULTITEXCOORD4DVSGISPROC glMTexCoord4dvSGIS = NULL;
    PFNGLMULTITEXCOORD4FSGISPROC glMTexCoord4fSGIS = NULL;
    PFNGLMULTITEXCOORD4FVSGISPROC glMTexCoord4fvSGIS = NULL;
    PFNGLMULTITEXCOORD4ISGISPROC glMTexCoord4iSGIS = NULL;
    PFNGLMULTITEXCOORD4IVSGISPROC glMTexCoord4ivSGIS = NULL;
    PFNGLMULTITEXCOORD4SSGISPROC glMTexCoord4sSGIS = NULL;
    PFNGLMULTITEXCOORD4SVSGISPROC glMTexCoord4svSGIS = NULL;
    #endif

    #ifdef GL_WIN_swap_hint
    GLboolean GL_WIN_swap_hint_Flag = GL_FALSE;
    PFNGLADDSWAPHINTRECTWINPROC glAddSwapHintRectWIN = NULL;
    #endif

    #ifdef GL_KTX_buffer_region
    GLboolean GL_KTX_buffer_region_Flag = GL_FALSE;
    PFNGLBUFFERREGIONENABLEDEXTPROC glBufferRegionEnabled = NULL;
    PFNGLNEWBUFFERREGIONEXTPROC glNewBufferRegion = NULL;
    PFNGLDELETEBUFFERREGIONEXTPROC glDeleteBufferRegion = NULL;
    PFNGLREADBUFFERREGIONEXTPROC glReadBufferRegion = NULL;
    PFNGLDRAWBUFFERREGIONEXTPROC glDrawBufferRegion = NULL;
    #endif

    #ifdef WGL_ARB_extensions_string
    GLboolean WGL_ARB_extensions_string_Flag = GL_FALSE;
    PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = NULL;
    #endif

    #ifdef WGL_EXT_extensions_string
    GLboolean WGL_EXT_extensions_string_Flag = GL_FALSE;
    PFNWGLGETEXTENSIONSSTRINGEXTPROC wglGetExtensionsStringEXT = NULL;
    #endif

    #ifdef WGL_EXT_swap_control
    GLboolean WGL_EXT_swap_control_Flag = GL_FALSE;
    PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
    PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = NULL;
    #endif

    #ifdef WGL_ARB_multisample
    GLboolean WGL_ARB_multisample_Flag = GL_FALSE;
    #endif

    #ifdef WGL_ARB_pixel_format
    GLboolean WGL_ARB_pixel_format_Flag = GL_FALSE;
    PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB = NULL;
    PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB = NULL;
    PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = NULL;
    #endif

    #ifdef WGL_ARB_make_current_read
    GLboolean WGL_ARB_make_current_read_Flag = GL_FALSE;
    PFNWGLMAKECONTEXTCURRENTARBPROC wglMakeContextCurrentARB = NULL;
    PFNWGLGETCURRENTREADDCARBPROC wglGetCurrentReadDCARB = NULL;
    #endif

    #ifdef WGL_ARB_pbuffer
    GLboolean WGL_ARB_pbuffer_Flag = GL_FALSE;
    PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB = NULL;
    PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB = NULL;
    PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB = NULL;
    PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB = NULL;
    PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB = NULL;
    #endif

    #ifdef WGL_ARB_render_texture
    GLboolean WGL_ARB_render_texture_Flag = GL_FALSE;
    PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB = NULL;
    PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB = NULL;
    PFNWGLSETPBUFFERATTRIBARBPROC wglSetPbufferAttribARB = NULL;
    #endif

    #ifdef WGL_ATI_pixel_format_float
    GLboolean WGL_ATI_pixel_format_float_Flag = GL_FALSE;
    #endif

    /* OpenGL 1.4 */
    #ifdef GL_EXT_multi_draw_arrays
    PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArrays = NULL;
    PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElements = NULL;
    #endif

    #ifdef GL_EXT_fog_coord
    PFNGLFOGCOORDFEXTPROC glFogCoordf = NULL;
    PFNGLFOGCOORDDEXTPROC glFogCoordd = NULL;
    PFNGLFOGCOORDFVEXTPROC glFogCoordfv = NULL;
    PFNGLFOGCOORDDVEXTPROC glFogCoorddv = NULL;
    PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer = NULL;
    #endif

    #if GL_EXT_point_parameters
    PFNGLPOINTPARAMETERFEXTPROC glPointParameterf = NULL;
    PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfv = NULL;
    #endif

    #ifdef GL_EXT_secondary_color
    PFNGLSECONDARYCOLOR3FEXTPROC glSecondaryColor3f = NULL;
    PFNGLSECONDARYCOLOR3DEXTPROC glSecondaryColor3d = NULL;
    PFNGLSECONDARYCOLOR3BEXTPROC glSecondaryColor3b = NULL;
    PFNGLSECONDARYCOLOR3SEXTPROC glSecondaryColor3s = NULL;
    PFNGLSECONDARYCOLOR3IEXTPROC glSecondaryColor3i = NULL;
    PFNGLSECONDARYCOLOR3UBEXTPROC glSecondaryColor3ub = NULL;
    PFNGLSECONDARYCOLOR3USEXTPROC glSecondaryColor3us = NULL;
    PFNGLSECONDARYCOLOR3UIEXTPROC glSecondaryColor3ui = NULL;
    PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fv = NULL;
    PFNGLSECONDARYCOLOR3DVEXTPROC glSecondaryColor3dv = NULL;
    PFNGLSECONDARYCOLOR3BVEXTPROC glSecondaryColor3bv = NULL;
    PFNGLSECONDARYCOLOR3SVEXTPROC glSecondaryColor3sv = NULL;
    PFNGLSECONDARYCOLOR3IVEXTPROC glSecondaryColor3iv = NULL;
    PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubv = NULL;
    PFNGLSECONDARYCOLOR3USVEXTPROC glSecondaryColor3usv = NULL;
    PFNGLSECONDARYCOLOR3UIVEXTPROC glSecondaryColor3uiv = NULL;
    PFNGLSECONDARYCOLORPOINTEREXTPROC glSecondaryColorPointer = NULL;
    #endif

    #ifdef GL_EXT_blend_func_separate
    PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparate = NULL;
    #endif

    #ifdef GL_ARB_window_pos
    PFNGLWINDOWPOS2DARBPROC glWindowPos2d = NULL;
    PFNGLWINDOWPOS2FARBPROC glWindowPos2f = NULL;
    PFNGLWINDOWPOS2IARBPROC glWindowPos2i = NULL;
    PFNGLWINDOWPOS2SARBPROC glWindowPos2s = NULL;
    PFNGLWINDOWPOS2IVARBPROC glWindowPos2iv = NULL;
    PFNGLWINDOWPOS2SVARBPROC glWindowPos2sv = NULL;
    PFNGLWINDOWPOS2FVARBPROC glWindowPos2fv = NULL;
    PFNGLWINDOWPOS2DVARBPROC glWindowPos2dv = NULL;
    PFNGLWINDOWPOS3IARBPROC glWindowPos3i = NULL;
    PFNGLWINDOWPOS3SARBPROC glWindowPos3s = NULL;
    PFNGLWINDOWPOS3FARBPROC glWindowPos3f = NULL;
    PFNGLWINDOWPOS3DARBPROC glWindowPos3d = NULL;
    PFNGLWINDOWPOS3IVARBPROC glWindowPos3iv = NULL;
    PFNGLWINDOWPOS3SVARBPROC glWindowPos3sv = NULL;
    PFNGLWINDOWPOS3FVARBPROC glWindowPos3fv = NULL;
    PFNGLWINDOWPOS3DVARBPROC glWindowPos3dv = NULL;
    #endif

    /* OpenGL 1.3 */
    #ifdef GL_ARB_multitexture
    PFNGLACTIVETEXTUREARBPROC glActiveTexture = NULL;
    PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture = NULL;
    PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1d = NULL;
    PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dv = NULL;
    PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1f = NULL;
    PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fv = NULL;
    PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1i = NULL;
    PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1iv = NULL;
    PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1s = NULL;
    PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1sv = NULL;
    PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2d = NULL;
    PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dv = NULL;
    PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f = NULL;
    PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fv = NULL;
    PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2i = NULL;
    PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2iv = NULL;
    PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2s = NULL;
    PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2sv = NULL;
    PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3d = NULL;
    PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dv = NULL;
    PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f = NULL;
    PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fv = NULL;
    PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3i = NULL;
    PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3iv = NULL;
    PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3s = NULL;
    PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3sv = NULL;
    PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4d = NULL;
    PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dv = NULL;
    PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4f = NULL;
    PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fv = NULL;
    PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4i = NULL;
    PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4iv = NULL;
    PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4s = NULL;
    PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4sv = NULL;
    #endif

    #ifdef GL_ARB_texture_compression
    PFNGLCOMPRESSEDTEXIMAGE3DARBPROC glCompressedTexImage3D = NULL;
    PFNGLCOMPRESSEDTEXIMAGE2DARBPROC glCompressedTexImage2D = NULL;
    PFNGLCOMPRESSEDTEXIMAGE1DARBPROC glCompressedTexImage1D = NULL;
    PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC glCompressedTexSubImage3D = NULL;
    PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC glCompressedTexSubImage2D = NULL;
    PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC glCompressedTexSubImage1D = NULL;
    PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImage = NULL;
    #endif

    #ifdef GL_ARB_multisample
    PFNGLSAMPLECOVERAGEARBPROC glSampleCoverage = NULL;
    #endif

    #ifdef GL_ARB_transpose_matrix
    PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixf = NULL;
    PFNGLLOADTRANSPOSEMATRIXDARBPROC glLoadTransposeMatrixd = NULL;
    PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixf = NULL;
    PFNGLMULTTRANSPOSEMATRIXDARBPROC glMultTransposeMatrixd = NULL;
    #endif

    /* OpenGL 1.2 */
    #ifdef GL_EXT_texture3D
    PFNGLTEXIMAGE3DEXTPROC glTexImage3D = NULL;
    PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D = NULL;
    PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D = NULL;
    #endif

    #ifdef GL_EXT_draw_range_elements
    PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElements = NULL;
    #endif

    /* GLSL extensions */
    #ifdef GL_ARB_shader_objects
    GLboolean GL_ARB_shader_objects_Flag = GL_FALSE;

    PFNGLDELETEOBJECTARBPROC                    glDeleteObjectARB           = NULL;
    PFNGLGETHANDLEARBPROC                       glGetHandleARB              = NULL;
    PFNGLDETACHOBJECTARBPROC                    glDetachObjectARB           = NULL;
    PFNGLCREATESHADEROBJECTARBPROC              glCreateShaderObjectARB     = NULL;
    PFNGLSHADERSOURCEARBPROC                    glShaderSourceARB           = NULL;
    PFNGLCOMPILESHADERARBPROC                   glCompileShaderARB          = NULL;
    PFNGLCREATEPROGRAMOBJECTARBPROC             glCreateProgramObjectARB    = NULL;
    PFNGLATTACHOBJECTARBPROC                    glAttachObjectARB           = NULL;
    PFNGLLINKPROGRAMARBPROC                     glLinkProgramARB            = NULL;
    PFNGLUSEPROGRAMOBJECTARBPROC                glUseProgramObjectARB       = NULL;
    PFNGLVALIDATEPROGRAMARBPROC                 glValidateProgramARB        = NULL;
    PFNGLUNIFORM1FARBPROC                       glUniform1fARB              = NULL;
    PFNGLUNIFORM2FARBPROC                       glUniform2fARB              = NULL;
    PFNGLUNIFORM3FARBPROC                       glUniform3fARB              = NULL;
    PFNGLUNIFORM4FARBPROC                       glUniform4fARB              = NULL;
    PFNGLUNIFORM1IARBPROC                       glUniform1iARB              = NULL;
    PFNGLUNIFORM2IARBPROC                       glUniform2iARB              = NULL;
    PFNGLUNIFORM3IARBPROC                       glUniform3iARB              = NULL;
    PFNGLUNIFORM4IARBPROC                       glUniform4iARB              = NULL;
    PFNGLUNIFORM1FVARBPROC                      glUniform1fvARB             = NULL;
    PFNGLUNIFORM2FVARBPROC                      glUniform2fvARB             = NULL;
    PFNGLUNIFORM3FVARBPROC                      glUniform3fvARB             = NULL;
    PFNGLUNIFORM4FVARBPROC                      glUniform4fvARB             = NULL;
    PFNGLUNIFORM1IVARBPROC                      glUniform1ivARB             = NULL;
    PFNGLUNIFORM2IVARBPROC                      glUniform2ivARB             = NULL;
    PFNGLUNIFORM3IVARBPROC                      glUniform3ivARB             = NULL;
    PFNGLUNIFORM4IVARBPROC                      glUniform4ivARB             = NULL;
    PFNGLUNIFORMMATRIX2FVARBPROC                glUniformMatrix2fvARB       = NULL;
    PFNGLUNIFORMMATRIX3FVARBPROC                glUniformMatrix3fvARB       = NULL;
    PFNGLUNIFORMMATRIX4FVARBPROC                glUniformMatrix4fvARB       = NULL;
    PFNGLGETOBJECTPARAMETERFVARBPROC            glGetObjectParameterfvARB   = NULL;
    PFNGLGETOBJECTPARAMETERIVARBPROC            glGetObjectParameterivARB   = NULL;
    PFNGLGETINFOLOGARBPROC                      glGetInfoLogARB             = NULL;
    PFNGLGETATTACHEDOBJECTSARBPROC              glGetAttachedObjectsARB     = NULL;
    PFNGLGETUNIFORMLOCATIONARBPROC              glGetUniformLocationARB     = NULL;
    PFNGLGETACTIVEUNIFORMARBPROC                glGetActiveUniformARB       = NULL;
    PFNGLGETUNIFORMFVARBPROC                    glGetUniformfvARB           = NULL;
    PFNGLGETUNIFORMIVARBPROC                    glGetUniformivARB           = NULL;
    PFNGLGETSHADERSOURCEARBPROC                 glGetShaderSourceARB        = NULL;
    #endif // GL_ARB_shader_objects

    #ifdef GL_ARB_vertex_shader
    GLboolean GL_ARB_vertex_shader_Flag = GL_FALSE;
    extern PFNGLBINDATTRIBLOCATIONARBPROC       glBindAttribLocationARB     = NULL;
    extern PFNGLGETACTIVEATTRIBARBPROC          glGetActiveAttribARB        = NULL;
    extern PFNGLGETATTRIBLOCATIONARBPROC        glGetAttribLocationARB      = NULL;
    #endif // GL_ARB_vertex_shader

    #ifdef GL_ARB_fragment_shader
    GLboolean GL_ARB_fragment_shader_Flag = GL_FALSE;
    #endif // GL_ARB_fragment_shader

    /* Get Function pointer safely */
    #ifdef WIN32
    #define SAFE_GET_PROC( func, type, fail)     \
       func = (type) wglGetProcAddress( #func);    \
       fail &= (func != NULL);
    #else
    #define SAFE_GET_PROC( func, type, fail)     \
       func = (type) glxGetProcAddress( #func);    \
       fail &= (func != NULL);
    #endif

    /* Determine if a particular extension is supported */
    int extensionSupported(const char* string, const char *extension)
    {
       const char *start;
       char *where, *terminator;

       where = strchr(extension, ' ');
       if (where || *extension == '\0')
          return 0;

       start = string;
       for (;;) {
          where = (GLubyte *) strstr( start, extension);
          if (!where)
             break;
          terminator = where + strlen(extension);
          if (where == start || *(where - 1) == ' ') {
             if (*terminator == ' ' || *terminator == '\0') {
                return 1;
             }
          }
          start = terminator;
       }
       return 0;
    }

    int SetupExtension(const char * extension)
    {

       const char *GLExtensionString = (const char*)glGetString(GL_EXTENSIONS);
       const char *WGLExtensionString = 0;
       int ret = TRUE;

       PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
       wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
       if(wglGetExtensionsStringARB)
       {
          WGLExtensionString = wglGetExtensionsStringARB(wglGetCurrentDC());
       }

       if(NULL == extension)
       {
          return FALSE;
       }
    #ifdef GL_ARB_window_pos
       else if (0 == strcmp(extension, "GL_ARB_window_pos"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glWindowPos2dARB, PFNGLWINDOWPOS2DARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2fARB, PFNGLWINDOWPOS2FARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2iARB, PFNGLWINDOWPOS2IARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2sARB, PFNGLWINDOWPOS2SARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2ivARB, PFNGLWINDOWPOS2IVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2svARB, PFNGLWINDOWPOS2SVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2fvARB, PFNGLWINDOWPOS2FVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2dvARB, PFNGLWINDOWPOS2DVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3iARB, PFNGLWINDOWPOS3IARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3sARB, PFNGLWINDOWPOS3SARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3fARB, PFNGLWINDOWPOS3FARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3dARB, PFNGLWINDOWPOS3DARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3ivARB, PFNGLWINDOWPOS3IVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3svARB, PFNGLWINDOWPOS3SVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3fvARB, PFNGLWINDOWPOS3FVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3dvARB, PFNGLWINDOWPOS3DVARBPROC, ret);

          if (ret)
          {
             GL_ARB_window_pos_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_window_pos */
    #ifdef GL_ARB_multisample
       else if (0 == strcmp(extension, "GL_ARB_multisample"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;

          SAFE_GET_PROC( glSampleCoverageARB, PFNGLSAMPLECOVERAGEARBPROC, ret);

          if (ret)
          {
    	      GL_ARB_multisample_Flag = GL_TRUE;
          }
       }
    #endif
    #ifdef GL_ARB_multitexture
       else if (0 == strcmp(extension, "GL_ARB_multitexture"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glActiveTextureARB, PFNGLACTIVETEXTUREARBPROC, ret);
          SAFE_GET_PROC( glClientActiveTextureARB, PFNGLCLIENTACTIVETEXTUREARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1dARB, PFNGLMULTITEXCOORD1DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1dvARB, PFNGLMULTITEXCOORD1DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1fARB, PFNGLMULTITEXCOORD1FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1fvARB, PFNGLMULTITEXCOORD1FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1iARB, PFNGLMULTITEXCOORD1IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1ivARB, PFNGLMULTITEXCOORD1IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1sARB, PFNGLMULTITEXCOORD1SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1svARB, PFNGLMULTITEXCOORD1SVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2dARB, PFNGLMULTITEXCOORD2DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2dvARB, PFNGLMULTITEXCOORD2DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2fARB, PFNGLMULTITEXCOORD2FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2fvARB, PFNGLMULTITEXCOORD2FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2iARB, PFNGLMULTITEXCOORD2IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2ivARB, PFNGLMULTITEXCOORD2IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2sARB, PFNGLMULTITEXCOORD2SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2svARB, PFNGLMULTITEXCOORD2SVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3dARB, PFNGLMULTITEXCOORD3DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3dvARB, PFNGLMULTITEXCOORD3DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3fARB, PFNGLMULTITEXCOORD3FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3fvARB, PFNGLMULTITEXCOORD3FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3iARB, PFNGLMULTITEXCOORD3IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3ivARB, PFNGLMULTITEXCOORD3IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3sARB, PFNGLMULTITEXCOORD3SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3svARB, PFNGLMULTITEXCOORD3SVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4dARB, PFNGLMULTITEXCOORD4DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4dvARB, PFNGLMULTITEXCOORD4DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4fARB, PFNGLMULTITEXCOORD4FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4fvARB, PFNGLMULTITEXCOORD4FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4iARB, PFNGLMULTITEXCOORD4IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4ivARB, PFNGLMULTITEXCOORD4IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4sARB, PFNGLMULTITEXCOORD4SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4svARB, PFNGLMULTITEXCOORD4SVARBPROC, ret);

          if (ret)
          {
             GL_ARB_multitexture_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_multitexture */
    #ifdef GL_ARB_texture_compression
       else if (0 == strcmp(extension, "GL_ARB_texture_compression"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glCompressedTexImage3DARB, PFNGLCOMPRESSEDTEXIMAGE3DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexImage2DARB, PFNGLCOMPRESSEDTEXIMAGE2DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexImage1DARB, PFNGLCOMPRESSEDTEXIMAGE1DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexSubImage3DARB, PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexSubImage2DARB, PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexSubImage1DARB, PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC, ret);
          SAFE_GET_PROC( glGetCompressedTexImageARB, PFNGLGETCOMPRESSEDTEXIMAGEARBPROC, ret);

          if (ret)
          {
             GL_ARB_texture_compression_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_compression */
    #ifdef GL_ARB_vertex_blend
       else if (0 == strcmp(extension, "GL_ARB_vertex_blend"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glWeightbvARB, PFNGLWEIGHTBVARBPROC, ret);
          SAFE_GET_PROC( glWeightsvARB, PFNGLWEIGHTSVARBPROC, ret);
          SAFE_GET_PROC( glWeightivARB, PFNGLWEIGHTIVARBPROC, ret);
          SAFE_GET_PROC( glWeightfvARB, PFNGLWEIGHTFVARBPROC, ret);
          SAFE_GET_PROC( glWeightdvARB, PFNGLWEIGHTDVARBPROC, ret);
          SAFE_GET_PROC( glWeightubvARB, PFNGLWEIGHTUBVARBPROC, ret);
          SAFE_GET_PROC( glWeightusvARB, PFNGLWEIGHTUSVARBPROC, ret);
          SAFE_GET_PROC( glWeightuivARB, PFNGLWEIGHTUIVARBPROC, ret);
          SAFE_GET_PROC( glWeightPointerARB, PFNGLWEIGHTPOINTERARBPROC, ret);
          SAFE_GET_PROC( glVertexBlendARB, PFNGLVERTEXBLENDARBPROC, ret);

          if (ret)
          {
             GL_ARB_vertex_blend_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_vertex_blend */
    #ifdef GL_ARB_vertex_buffer_object
       else if (0 == strcmp(extension, "GL_ARB_vertex_buffer_object"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glBindBufferARB, PFNGLBINDBUFFERARBPROC, ret);
          SAFE_GET_PROC( glDeleteBuffersARB, PFNGLDELETEBUFFERSARBPROC, ret);
          SAFE_GET_PROC( glGenBuffersARB, PFNGLGENBUFFERSARBPROC, ret);
          SAFE_GET_PROC( glIsBufferARB, PFNGLISBUFFERARBPROC, ret);
          SAFE_GET_PROC( glBufferDataARB, PFNGLBUFFERDATAARBPROC, ret);
          SAFE_GET_PROC( glBufferSubDataARB, PFNGLBUFFERSUBDATAARBPROC, ret);
          SAFE_GET_PROC( glGetBufferSubDataARB, PFNGLGETBUFFERSUBDATAARBPROC, ret);
          SAFE_GET_PROC( glMapBufferARB, PFNGLMAPBUFFERARBPROC, ret);
          SAFE_GET_PROC( glUnmapBufferARB, PFNGLUNMAPBUFFERARBPROC, ret);
          SAFE_GET_PROC( glGetBufferParameterivARB, PFNGLGETBUFFERPARAMETERIVARBPROC, ret);
          SAFE_GET_PROC( glGetBufferPointervARB, PFNGLGETBUFFERPOINTERVARBPROC, ret);

          if (ret)
          {
             GL_ARB_vertex_buffer_object_flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_vertex_buffer_object */
    #ifdef GL_ARB_transpose_matrix
       else if (0 == strcmp(extension, "GL_ARB_transpose_matrix"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glLoadTransposeMatrixfARB, PFNGLLOADTRANSPOSEMATRIXFARBPROC, ret);
          SAFE_GET_PROC( glLoadTransposeMatrixdARB, PFNGLLOADTRANSPOSEMATRIXDARBPROC, ret);
          SAFE_GET_PROC( glMultTransposeMatrixfARB, PFNGLMULTTRANSPOSEMATRIXFARBPROC, ret);
          SAFE_GET_PROC( glMultTransposeMatrixdARB, PFNGLMULTTRANSPOSEMATRIXDARBPROC, ret);

          if (ret)
          {
             GL_ARB_transpose_matrix_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_transpose_matrix */
    #ifdef GL_ARB_vertex_program
       else if (0 == strcmp(extension, "GL_ARB_vertex_program"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glVertexAttrib1sARB, PFNGLVERTEXATTRIB1SARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib1fARB, PFNGLVERTEXATTRIB1FARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib1dARB, PFNGLVERTEXATTRIB1DARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib2sARB, PFNGLVERTEXATTRIB2SARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib2fARB, PFNGLVERTEXATTRIB2FARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib2dARB, PFNGLVERTEXATTRIB2DARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib3sARB, PFNGLVERTEXATTRIB3SARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib3fARB, PFNGLVERTEXATTRIB3FARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib3dARB, PFNGLVERTEXATTRIB3DARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4sARB, PFNGLVERTEXATTRIB4SARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4fARB, PFNGLVERTEXATTRIB4FARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4dARB, PFNGLVERTEXATTRIB4DARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NubARB, PFNGLVERTEXATTRIB4NUBARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib1svARB, PFNGLVERTEXATTRIB1SVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib1fvARB, PFNGLVERTEXATTRIB1FVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib1dvARB, PFNGLVERTEXATTRIB1DVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib2svARB, PFNGLVERTEXATTRIB2SVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib2fvARB, PFNGLVERTEXATTRIB2FVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib2dvARB, PFNGLVERTEXATTRIB2DVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib3svARB, PFNGLVERTEXATTRIB3SVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib3fvARB, PFNGLVERTEXATTRIB3FVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib3dvARB, PFNGLVERTEXATTRIB3DVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4svARB, PFNGLVERTEXATTRIB4SVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4fvARB, PFNGLVERTEXATTRIB4FVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4dvARB, PFNGLVERTEXATTRIB4DVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4ivARB, PFNGLVERTEXATTRIB4IVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4bvARB, PFNGLVERTEXATTRIB4BVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4usvARB, PFNGLVERTEXATTRIB4USVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4ubvARB, PFNGLVERTEXATTRIB4UBVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4uivARB, PFNGLVERTEXATTRIB4UIVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NbvARB, PFNGLVERTEXATTRIB4NBVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NsvARB, PFNGLVERTEXATTRIB4NSVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NivARB, PFNGLVERTEXATTRIB4NIVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NubvARB, PFNGLVERTEXATTRIB4NUBVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NusvARB, PFNGLVERTEXATTRIB4NUSVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttrib4NuivARB, PFNGLVERTEXATTRIB4NUIVARBPROC, ret);
          SAFE_GET_PROC( glVertexAttribPointerARB, PFNGLVERTEXATTRIBPOINTERARBPROC, ret);
          SAFE_GET_PROC( glEnableVertexAttribArrayARB, PFNGLENABLEVERTEXATTRIBARRAYARBPROC, ret);
          SAFE_GET_PROC( glDisableVertexAttribArrayARB, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC, ret);
          SAFE_GET_PROC( glProgramStringARB, PFNGLPROGRAMSTRINGARBPROC, ret);
          SAFE_GET_PROC( glBindProgramARB, PFNGLBINDPROGRAMARBPROC, ret);
          SAFE_GET_PROC( glDeleteProgramsARB, PFNGLDELETEPROGRAMSARBPROC, ret);
          SAFE_GET_PROC( glGenProgramsARB, PFNGLGENPROGRAMSARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4dARB, PFNGLPROGRAMENVPARAMETER4DARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4dvARB, PFNGLPROGRAMENVPARAMETER4DVARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4fARB, PFNGLPROGRAMENVPARAMETER4FARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4fvARB, PFNGLPROGRAMENVPARAMETER4FVARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4dARB, PFNGLPROGRAMLOCALPARAMETER4DARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4dvARB, PFNGLPROGRAMLOCALPARAMETER4DVARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4fARB, PFNGLPROGRAMLOCALPARAMETER4FARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4fvARB, PFNGLPROGRAMLOCALPARAMETER4FVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramEnvParameterdvARB, PFNGLGETPROGRAMENVPARAMETERDVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramEnvParameterfvARB, PFNGLGETPROGRAMENVPARAMETERFVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramLocalParameterdvARB, PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramLocalParameterfvARB, PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramivARB, PFNGLGETPROGRAMIVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramStringARB, PFNGLGETPROGRAMSTRINGARBPROC, ret);
          SAFE_GET_PROC( glGetVertexAttribdvARB, PFNGLGETVERTEXATTRIBDVARBPROC, ret);
          SAFE_GET_PROC( glGetVertexAttribfvARB, PFNGLGETVERTEXATTRIBFVARBPROC, ret);
          SAFE_GET_PROC( glGetVertexAttribivARB, PFNGLGETVERTEXATTRIBIVARBPROC, ret);
          SAFE_GET_PROC( glGetVertexAttribPointervARB, PFNGLGETVERTEXATTRIBPOINTERVARBPROC, ret);
          SAFE_GET_PROC( glIsProgramARB, PFNGLISPROGRAMARBPROC, ret);

          if (ret)
          {
             GL_ARB_vertex_program_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_vertex_program */
    #ifdef GL_ARB_fragment_program
       else if (0 == strcmp(extension, "GL_ARB_fragment_program"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glProgramStringARB, PFNGLPROGRAMSTRINGARBPROC, ret);
          SAFE_GET_PROC( glBindProgramARB, PFNGLBINDPROGRAMARBPROC, ret);
          SAFE_GET_PROC( glDeleteProgramsARB, PFNGLDELETEPROGRAMSARBPROC, ret);
          SAFE_GET_PROC( glGenProgramsARB, PFNGLGENPROGRAMSARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4dARB, PFNGLPROGRAMENVPARAMETER4DARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4dvARB, PFNGLPROGRAMENVPARAMETER4DVARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4fARB, PFNGLPROGRAMENVPARAMETER4FARBPROC, ret);
          SAFE_GET_PROC( glProgramEnvParameter4fvARB, PFNGLPROGRAMENVPARAMETER4FVARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4dARB, PFNGLPROGRAMLOCALPARAMETER4DARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4dvARB, PFNGLPROGRAMLOCALPARAMETER4DVARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4fARB, PFNGLPROGRAMLOCALPARAMETER4FARBPROC, ret);
          SAFE_GET_PROC( glProgramLocalParameter4fvARB, PFNGLPROGRAMLOCALPARAMETER4FVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramEnvParameterdvARB, PFNGLGETPROGRAMENVPARAMETERDVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramEnvParameterfvARB, PFNGLGETPROGRAMENVPARAMETERFVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramLocalParameterdvARB, PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramLocalParameterfvARB, PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramivARB, PFNGLGETPROGRAMIVARBPROC, ret);
          SAFE_GET_PROC( glGetProgramStringARB, PFNGLGETPROGRAMSTRINGARBPROC, ret);
          SAFE_GET_PROC( glIsProgramARB, PFNGLISPROGRAMARBPROC, ret);

          if (ret)
          {
             GL_ARB_fragment_program_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_fragment_program */
    #ifdef GL_ARB_depth_texture
       else if (0 == strcmp( extension, "GL_ARB_depth_texture"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_depth_texture_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_depth_texture */
    #ifdef GL_ARB_shadow
       else if (0 == strcmp( extension, "GL_ARB_shadow"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_shadow_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_shadow */
    #ifdef GL_ARB_shadow_ambient
       else if (0 == strcmp( extension, "GL_ARB_shadow_ambient"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_shadow_ambient_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_shadow_ambient */
    #ifdef GL_ARB_texture_border_clamp
       else if (0 == strcmp( extension, "GL_ARB_texture_border_clamp"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_border_clamp_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_border_clamp */
    #ifdef GL_ARB_texture_mirror_repeat
       else if (0 == strcmp( extension, "GL_ARB_texture_mirror_repeat"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_mirror_repeat_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_mirror_repeat */
    #ifdef GL_ARB_texture_cube_map
       else if (0 == strcmp( extension, "GL_ARB_texture_cube_map"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_cube_map_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_cube_map */
    #ifdef GL_ARB_texture_env_add
       else if (0 == strcmp( extension, "GL_ARB_texture_env_add"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_env_add_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_env_add */
    #ifdef GL_ARB_texture_env_combine
       else if (0 == strcmp( extension, "GL_ARB_texture_env_combine"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_env_combine_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_env_combine */
    #ifdef GL_ARB_texture_env_crossbar
       else if (0 == strcmp( extension, "GL_ARB_texture_env_crossbar"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_env_crossbar_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_env_crossbar */
    #ifdef GL_ARB_texture_env_dot3
       else if (0 == strcmp( extension, "GL_ARB_texture_env_dot3"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_texture_env_dot3_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_texture_env_dot3 */
    #ifdef GL_ARB_point_sprite
       else if (0 == strcmp( extension, "GL_ARB_point_sprite"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          if (ret)
          {
             GL_ARB_point_sprite_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_point_sprite */
    #ifdef GL_EXT_vertex_array
       else if (0 == strcmp(extension, "GL_EXT_vertex_array"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glArrayElementEXT, PFNGLARRAYELEMENTEXTPROC, ret);
          SAFE_GET_PROC( glDrawArraysEXT, PFNGLDRAWARRAYSEXTPROC, ret);
          SAFE_GET_PROC( glVertexPointerEXT, PFNGLVERTEXPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glNormalPointerEXT, PFNGLNORMALPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glColorPointerEXT, PFNGLCOLORPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glIndexPointerEXT, PFNGLINDEXPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glTexCoordPointerEXT, PFNGLTEXCOORDPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glEdgeFlagPointerEXT, PFNGLEDGEFLAGPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glGetPointervEXT, PFNGLGETPOINTERVEXTPROC, ret);

          if (ret)
          {
             GL_EXT_vertex_array_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_vertex_array */
    #ifdef GL_EXT_compiled_vertex_array
       else if (0 == strcmp(extension, "GL_EXT_compiled_vertex_array"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glLockArraysEXT, PFNGLLOCKARRAYSEXTPROC, ret);
          SAFE_GET_PROC( glUnlockArraysEXT, PFNGLUNLOCKARRAYSEXTPROC, ret);

          if (ret)
          {
             GL_EXT_compiled_vertex_array_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_compiled_vertex_array */
    #ifdef GL_EXT_texture_object
       else if (0 == strcmp(extension, "GL_EXT_texture_object"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glGenTexturesEXT, PFNGLGENTEXTURESEXTPROC, ret);
          SAFE_GET_PROC( glDeleteTexturesEXT, PFNGLDELETETEXTURESEXTPROC, ret);
          SAFE_GET_PROC( glBindTextureEXT, PFNGLBINDTEXTUREEXTPROC, ret);
          SAFE_GET_PROC( glPrioritizeTexturesEXT, PFNGLPRIORITIZETEXTURESEXTPROC, ret);
          SAFE_GET_PROC( glAreTexturesResidentEXT, PFNGLARETEXTURESRESIDENTEXTPROC, ret);
          SAFE_GET_PROC( glIsTextureEXT, PFNGLISTEXTUREEXTPROC, ret);

          if (ret)
          {
             GL_EXT_texture_object_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_texture_object */
    #ifdef GL_EXT_fog_coord
       else if (0 == strcmp(extension, "GL_EXT_fog_coord"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glFogCoordfEXT, PFNGLFOGCOORDFEXTPROC, ret);
          SAFE_GET_PROC( glFogCoorddEXT, PFNGLFOGCOORDDEXTPROC, ret);
          SAFE_GET_PROC( glFogCoordfvEXT, PFNGLFOGCOORDFVEXTPROC, ret);
          SAFE_GET_PROC( glFogCoorddvEXT, PFNGLFOGCOORDDVEXTPROC, ret);
          SAFE_GET_PROC( glFogCoordPointerEXT, PFNGLFOGCOORDPOINTEREXTPROC, ret);

          if (ret)
          {
             GL_EXT_fog_coord_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_fog_coord */
    #ifdef GL_EXT_secondary_color
       else if (0 == strcmp(extension, "GL_EXT_secondary_color"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glSecondaryColor3fEXT, PFNGLSECONDARYCOLOR3FEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3dEXT, PFNGLSECONDARYCOLOR3DEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3bEXT, PFNGLSECONDARYCOLOR3BEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3sEXT, PFNGLSECONDARYCOLOR3SEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3iEXT, PFNGLSECONDARYCOLOR3IEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3ubEXT, PFNGLSECONDARYCOLOR3UBEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3usEXT, PFNGLSECONDARYCOLOR3USEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3uiEXT, PFNGLSECONDARYCOLOR3UIEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3fvEXT, PFNGLSECONDARYCOLOR3FVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3dvEXT, PFNGLSECONDARYCOLOR3DVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3bvEXT, PFNGLSECONDARYCOLOR3BVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3svEXT, PFNGLSECONDARYCOLOR3SVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3ivEXT, PFNGLSECONDARYCOLOR3IVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3ubvEXT, PFNGLSECONDARYCOLOR3UBVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3usvEXT, PFNGLSECONDARYCOLOR3USVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3uivEXT, PFNGLSECONDARYCOLOR3UIVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColorPointerEXT, PFNGLSECONDARYCOLORPOINTEREXTPROC, ret);

          if (ret)
          {
             GL_EXT_secondary_color_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_secondary_color */
    #ifdef GL_EXT_draw_range_elements
       else if (0 == strcmp(extension, "GL_EXT_draw_range_elements"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glDrawRangeElementsEXT, PFNGLDRAWRANGEELEMENTSEXTPROC, ret);

          if (ret)
          {
             GL_EXT_draw_range_elements_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_draw_range_elements */
    #ifdef GL_EXT_multi_draw_arrays
       else if (0 == strcmp(extension, "GL_EXT_multi_draw_arrays"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;

          SAFE_GET_PROC( glMultiDrawArraysEXT, PFNGLMULTIDRAWARRAYSEXTPROC, ret);
          SAFE_GET_PROC( glMultiDrawElementsEXT, PFNGLMULTIDRAWELEMENTSEXTPROC, ret);

          if (ret)
          {
             GL_EXT_multi_draw_arrays_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_multi_draw_arrays */
    #ifdef GL_EXT_texture3D
       else if (0 == strcmp(extension, "GL_EXT_texture3D"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glTexImage3DEXT, PFNGLTEXIMAGE3DEXTPROC, ret);
          SAFE_GET_PROC( glTexSubImage3DEXT, PFNGLTEXSUBIMAGE3DPROC, ret);
          SAFE_GET_PROC( glCopyTexSubImage3DEXT, PFNGLCOPYTEXSUBIMAGE3DPROC, ret);

          if (ret)
          {
             GL_EXT_texture3D_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_texture3D */
    #ifdef GL_EXT_point_parameters
       else if (0 == strcmp(extension, "GL_EXT_point_parameters"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glPointParameterfEXT, PFNGLPOINTPARAMETERFEXTPROC, ret);
          SAFE_GET_PROC( glPointParameterfvEXT, PFNGLPOINTPARAMETERFVEXTPROC, ret);

          if (ret)
          {
             GL_EXT_point_parameters_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_point_parameters */
    #ifdef GL_ARB_point_parameters
       else if (0 == strcmp(extension, "GL_ARB_point_parameters"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glPointParameterfARB, PFNGLPOINTPARAMETERFEXTPROC, ret);
          SAFE_GET_PROC( glPointParameterfvARB, PFNGLPOINTPARAMETERFVEXTPROC, ret);

          if (ret)
          {
             GL_ARB_point_parameters_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_point_parameters */
    #ifdef GL_EXT_vertex_shader
       else if (0 == strcmp(extension, "GL_EXT_vertex_shader"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glBeginVertexShaderEXT, PFNGLBEGINVERTEXSHADEREXTPROC, ret);
          SAFE_GET_PROC( glEndVertexShaderEXT, PFNGLENDVERTEXSHADEREXTPROC, ret);
          SAFE_GET_PROC( glBindVertexShaderEXT, PFNGLBINDVERTEXSHADEREXTPROC, ret);
          SAFE_GET_PROC( glGenVertexShadersEXT, PFNGLGENVERTEXSHADERSEXTPROC, ret);
          SAFE_GET_PROC( glDeleteVertexShaderEXT, PFNGLDELETEVERTEXSHADEREXTPROC, ret);
          SAFE_GET_PROC( glShaderOp1EXT, PFNGLSHADEROP1EXTPROC, ret);
          SAFE_GET_PROC( glShaderOp2EXT, PFNGLSHADEROP2EXTPROC, ret);
          SAFE_GET_PROC( glShaderOp3EXT, PFNGLSHADEROP3EXTPROC, ret);
          SAFE_GET_PROC( glSwizzleEXT, PFNGLSWIZZLEEXTPROC, ret);
          SAFE_GET_PROC( glWriteMaskEXT, PFNGLWRITEMASKEXTPROC, ret);
          SAFE_GET_PROC( glInsertComponentEXT, PFNGLINSERTCOMPONENTEXTPROC, ret);
          SAFE_GET_PROC( glExtractComponentEXT, PFNGLEXTRACTCOMPONENTEXTPROC, ret);
          SAFE_GET_PROC( glGenSymbolsEXT, PFNGLGENSYMBOLSEXTPROC, ret);
          SAFE_GET_PROC( glSetInvariantEXT, PFNGLSETINVARIANTEXTPROC, ret);
          SAFE_GET_PROC( glSetLocalConstantEXT, PFNGLSETLOCALCONSTANTEXTPROC, ret);
          SAFE_GET_PROC( glVariantbvEXT, PFNGLVARIANTBVEXTPROC, ret);
          SAFE_GET_PROC( glVariantsvEXT, PFNGLVARIANTSVEXTPROC, ret);
          SAFE_GET_PROC( glVariantivEXT, PFNGLVARIANTIVEXTPROC, ret);
          SAFE_GET_PROC( glVariantfvEXT, PFNGLVARIANTFVEXTPROC, ret);
          SAFE_GET_PROC( glVariantdvEXT, PFNGLVARIANTDVEXTPROC, ret);
          SAFE_GET_PROC( glVariantubvEXT, PFNGLVARIANTUBVEXTPROC, ret);
          SAFE_GET_PROC( glVariantusvEXT, PFNGLVARIANTUSVEXTPROC, ret);
          SAFE_GET_PROC( glVariantuivEXT, PFNGLVARIANTUIVEXTPROC, ret);
          SAFE_GET_PROC( glVariantPointerEXT, PFNGLVARIANTPOINTEREXTPROC, ret);
          SAFE_GET_PROC( glEnableVariantClientStateEXT, PFNGLENABLEVARIANTCLIENTSTATEEXTPROC, ret);
          SAFE_GET_PROC( glDisableVariantClientStateEXT, PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC, ret);
          SAFE_GET_PROC( glBindLightParameterEXT, PFNGLBINDLIGHTPARAMETEREXTPROC, ret);
          SAFE_GET_PROC( glBindMaterialParameterEXT, PFNGLBINDMATERIALPARAMETEREXTPROC, ret);
          SAFE_GET_PROC( glBindTexGenParameterEXT, PFNGLBINDTEXGENPARAMETEREXTPROC, ret);
          SAFE_GET_PROC( glBindTextureUnitParameterEXT, PFNGLBINDTEXTUREUNITPARAMETEREXTPROC, ret);
          SAFE_GET_PROC( glBindParameterEXT, PFNGLBINDPARAMETEREXTPROC, ret);
          SAFE_GET_PROC( glIsVariantEnabledEXT, PFNGLISVARIANTENABLEDEXTPROC, ret);
          SAFE_GET_PROC( glGetVariantBooleanvEXT, PFNGLGETVARIANTBOOLEANVEXTPROC, ret);
          SAFE_GET_PROC( glGetVariantIntegervEXT, PFNGLGETVARIANTINTEGERVEXTPROC, ret);
          SAFE_GET_PROC( glGetVariantFloatvEXT, PFNGLGETVARIANTFLOATVEXTPROC, ret);
          SAFE_GET_PROC( glGetVariantPointervEXT, PFNGLGETVARIANTPOINTERVEXTPROC, ret);
          SAFE_GET_PROC( glGetInvariantBooleanvEXT, PFNGLGETINVARIANTBOOLEANVEXTPROC, ret);
          SAFE_GET_PROC( glGetInvariantIntegervEXT, PFNGLGETINVARIANTINTEGERVEXTPROC, ret);
          SAFE_GET_PROC( glGetInvariantFloatvEXT, PFNGLGETINVARIANTFLOATVEXTPROC, ret);
          SAFE_GET_PROC( glGetLocalConstantBooleanvEXT, PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC, ret);
          SAFE_GET_PROC( glGetLocalConstantIntegervEXT, PFNGLGETLOCALCONSTANTINTEGERVEXTPROC, ret);
          SAFE_GET_PROC( glGetLocalConstantFloatvEXT, PFNGLGETLOCALCONSTANTFLOATVEXTPROC, ret);

          if (ret)
          {
             GL_EXT_vertex_shader_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_vertex_shader */
    #ifdef GL_EXT_blend_minmax
       else if (0 == strcmp(extension, "GL_EXT_blend_minmax"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glBlendEquationEXT, PFNGLBLENDEQUATIONEXTPROC, ret);

          if (ret)
          {
             GL_EXT_blend_minmax_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_blend_minmax */
    #ifdef GL_EXT_blend_func_separate
       else if (0 == strcmp(extension, "GL_EXT_blend_func_separate"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glBlendFuncSeparateEXT, PFNGLBLENDFUNCSEPARATEEXTPROC, ret);

          if (ret)
          {
             GL_EXT_blend_func_separate_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_blend_func_separate */
    #ifdef GL_EXT_abgr
       else if (0 == strcmp( extension, "GL_EXT_abgr"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_abgr_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_bgra
       else if (0 == strcmp( extension, "GL_EXT_bgra"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_bgra_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_blend_subtract
       else if (0 == strcmp( extension, "GL_EXT_blend_subtract"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_blend_subtract_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_clip_volume_hint
       else if (0 == strcmp( extension, "GL_EXT_clip_volume_hint"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_clip_volume_hint_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_packed_pixels
       else if (0 == strcmp( extension, "GL_EXT_packed_pixels"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_packed_pixels_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_rescale_normal
       else if (0 == strcmp( extension, "GL_EXT_rescale_normal"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_rescale_normal_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_separate_specular_color
       else if (0 == strcmp( extension, "GL_EXT_separate_specular_color"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_separate_specular_color_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texgen_reflection
       else if (0 == strcmp( extension, "GL_EXT_texgen_reflection"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texgen_reflection_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_cube_map
       else if (0 == strcmp( extension, "GL_EXT_texture_cube_map"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_cube_map_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_compression_s3tc
       else if (0 == strcmp( extension, "GL_EXT_texture_compression_s3tc"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_compression_s3tc_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_edge_clamp
       else if (0 == strcmp( extension, "GL_EXT_texture_edge_clamp"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_edge_clamp_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_env_add
       else if (0 == strcmp( extension, "GL_EXT_texture_env_add"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_env_add_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_env_combine
       else if (0 == strcmp( extension, "GL_EXT_texture_env_combine"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_env_combine_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_env_dot3
       else if (0 == strcmp( extension, "GL_EXT_texture_env_dot3"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_env_dot3_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_texture_filter_anisotropic
       else if (0 == strcmp( extension, "GL_EXT_texture_filter_anisotropic"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_texture_filter_anisotropic_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_stencil_wrap
       else if (0 == strcmp( extension, "GL_EXT_stencil_wrap"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_EXT_stencil_wrap_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_EXT_blend_color
       else if (0 == strcmp(extension, "GL_EXT_blend_color"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glBlendColorEXT, PFNGLBLENDCOLOREXTPROC, ret);

          if (ret)
          {
             GL_EXT_blend_color_Flag = GL_TRUE;
          }
       }
    #endif /* GL_EXT_blend_color */
    #ifdef GL_EXT_texture_rectangle
       else if (0 == strcmp(extension, "GL_EXT_texture_rectangle"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;

          GL_EXT_texture_rectangle_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_ATI_envmap_bumpmap
       else if (0 == strcmp(extension, "GL_ATI_envmap_bumpmap"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glTexBumpParameterivATI, PFNGLTEXBUMPPARAMETERIVATIPROC, ret);
          SAFE_GET_PROC( glTexBumpParameterfvATI, PFNGLTEXBUMPPARAMETERFVATIPROC, ret);
          SAFE_GET_PROC( glGetTexBumpParameterivATI, PFNGLGETTEXBUMPPARAMETERIVATIPROC, ret);
          SAFE_GET_PROC( glGetTexBumpParameterfvATI, PFNGLGETTEXBUMPPARAMETERFVATIPROC, ret);

          if (ret)
          {
             GL_ATI_envmap_bumpmap_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_envmap_bumpmap */
    #ifdef GL_ATI_fragment_shader
       else if (0 == strcmp(extension, "GL_ATI_fragment_shader"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glGenFragmentShadersATI, PFNGLGENFRAGMENTSHADERSATIPROC, ret);
          SAFE_GET_PROC( glBindFragmentShaderATI, PFNGLBINDFRAGMENTSHADERATIPROC, ret);
          SAFE_GET_PROC( glDeleteFragmentShaderATI, PFNGLDELETEFRAGMENTSHADERATIPROC, ret);
          SAFE_GET_PROC( glBeginFragmentShaderATI, PFNGLBEGINFRAGMENTSHADERATIPROC, ret);
          SAFE_GET_PROC( glEndFragmentShaderATI, PFNGLENDFRAGMENTSHADERATIPROC, ret);
          SAFE_GET_PROC( glPassTexCoordATI, PFNGLPASSTEXCOORDATIPROC, ret);
          SAFE_GET_PROC( glSampleMapATI, PFNGLSAMPLEMAPATIPROC, ret);
          SAFE_GET_PROC( glColorFragmentOp1ATI, PFNGLCOLORFRAGMENTOP1ATIPROC, ret);
          SAFE_GET_PROC( glColorFragmentOp2ATI, PFNGLCOLORFRAGMENTOP2ATIPROC, ret);
          SAFE_GET_PROC( glColorFragmentOp3ATI, PFNGLCOLORFRAGMENTOP3ATIPROC, ret);
          SAFE_GET_PROC( glAlphaFragmentOp1ATI, PFNGLALPHAFRAGMENTOP1ATIPROC, ret);
          SAFE_GET_PROC( glAlphaFragmentOp2ATI, PFNGLALPHAFRAGMENTOP2ATIPROC, ret);
          SAFE_GET_PROC( glAlphaFragmentOp3ATI, PFNGLALPHAFRAGMENTOP3ATIPROC, ret);
          SAFE_GET_PROC( glSetFragmentShaderConstantATI, PFNGLSETFRAGMENTSHADERCONSTANTATIPROC, ret);

          if (ret)
          {
             GL_ATI_fragment_shader_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_fragment_shader */
    #ifdef GL_ATI_vertex_array_object
       else if (0 == strcmp(extension, "GL_ATI_vertex_array_object"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glNewObjectBufferATI, PFNGLNEWOBJECTBUFFERATIPROC, ret);
          SAFE_GET_PROC( glIsObjectBufferATI, PFNGLISOBJECTBUFFERATIPROC, ret);
          SAFE_GET_PROC( glUpdateObjectBufferATI, PFNGLUPDATEOBJECTBUFFERATIPROC, ret);
          SAFE_GET_PROC( glGetObjectBufferfvATI, PFNGLGETOBJECTBUFFERFVATIPROC, ret);
          SAFE_GET_PROC( glGetObjectBufferivATI, PFNGLGETOBJECTBUFFERIVATIPROC, ret);
          SAFE_GET_PROC( glFreeObjectBufferATI, PFNGLFREEOBJECTBUFFERATIPROC, ret);
          SAFE_GET_PROC( glArrayObjectATI, PFNGLARRAYOBJECTATIPROC, ret);
          SAFE_GET_PROC( glGetArrayObjectfvATI, PFNGLGETARRAYOBJECTFVATIPROC, ret);
          SAFE_GET_PROC( glGetArrayObjectivATI, PFNGLGETARRAYOBJECTIVATIPROC, ret);
          SAFE_GET_PROC( glVariantArrayObjectATI, PFNGLVARIANTARRAYOBJECTATIPROC, ret);
          SAFE_GET_PROC( glGetVariantArrayObjectfvATI, PFNGLGETVARIANTARRAYOBJECTFVATIPROC, ret);
          SAFE_GET_PROC( glGetVariantArrayObjectivATI, PFNGLGETVARIANTARRAYOBJECTIVATIPROC, ret);

          if (ret)
          {
             GL_ATI_vertex_array_object_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_vertex_array_object */
    #ifdef GL_ATI_element_array
       else if (0 == strcmp(extension, "GL_ATI_element_array"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glElementPointerATI, PFNGLELEMENTPOINTERATIPROC, ret);
          SAFE_GET_PROC( glDrawElementArrayATI, PFNGLDRAWELEMENTARRAYATIPROC, ret);
          SAFE_GET_PROC( glDrawRangeElementArrayATI, PFNGLDRAWRANGEELEMENTARRAYATIPROC, ret);

          if (ret)
          {
             GL_ATI_element_array_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_element_array */
    #ifdef GL_ATI_vertex_attrib_array_object
       else if (0 == strcmp(extension, "GL_ATI_vertex_attrib_array_object"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glVertexAttribArrayObjectATI, PFNGLVERTEXATTRIBARRAYOBJECTATIPROC, ret);
          SAFE_GET_PROC( glVertexAttribArrayObjectfvATI, PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC, ret);
          SAFE_GET_PROC( glVertexAttribArrayObjectivATI, PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC, ret);

          if (ret)
          {
             GL_ATI_vertex_attrib_array_object_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_vertex_attrib_array_object */
    #ifdef GL_ATI_pn_triangles
       else if (0 == strcmp(extension, "GL_ATI_pn_triangles"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glPNTrianglesiATI, PFNGLPNTRIANGLESIATIPROC, ret);
          SAFE_GET_PROC( glPNTrianglesfATI, PFNGLPNTRIANGLESFATIPROC, ret);

          if (ret)
          {
             GL_ATI_pn_triangles_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_pn_triangles */
    #ifdef GL_ATI_vertex_streams
       else if (0 == strcmp(extension, "GL_ATI_vertex_streams"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glClientActiveVertexStreamATI, PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC, ret);
          SAFE_GET_PROC( glVertexBlendEnviATI, PFNGLVERTEXBLENDENVIATIPROC, ret);
          SAFE_GET_PROC( glVertexBlendEnvfATI, PFNGLVERTEXBLENDENVFATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2sATI, PFNGLVERTEXSTREAM2SATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2svATI, PFNGLVERTEXSTREAM2SVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2iATI, PFNGLVERTEXSTREAM2IATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2ivATI, PFNGLVERTEXSTREAM2IVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2fATI, PFNGLVERTEXSTREAM2FATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2fvATI, PFNGLVERTEXSTREAM2FVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2dATI, PFNGLVERTEXSTREAM2DATIPROC, ret);
          SAFE_GET_PROC( glVertexStream2dvATI, PFNGLVERTEXSTREAM2DVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3sATI, PFNGLVERTEXSTREAM3SATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3svATI, PFNGLVERTEXSTREAM3SVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3iATI, PFNGLVERTEXSTREAM3IATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3ivATI, PFNGLVERTEXSTREAM3IVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3fATI, PFNGLVERTEXSTREAM3FATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3fvATI, PFNGLVERTEXSTREAM3FVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3dATI, PFNGLVERTEXSTREAM3DATIPROC, ret);
          SAFE_GET_PROC( glVertexStream3dvATI, PFNGLVERTEXSTREAM3DVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4sATI, PFNGLVERTEXSTREAM4SATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4svATI, PFNGLVERTEXSTREAM4SVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4iATI, PFNGLVERTEXSTREAM4IATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4ivATI, PFNGLVERTEXSTREAM4IVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4fATI, PFNGLVERTEXSTREAM4FATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4fvATI, PFNGLVERTEXSTREAM4FVATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4dATI, PFNGLVERTEXSTREAM4DATIPROC, ret);
          SAFE_GET_PROC( glVertexStream4dvATI, PFNGLVERTEXSTREAM4DVATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3bATI, PFNGLNORMALSTREAM3BATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3bvATI, PFNGLNORMALSTREAM3BVATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3sATI, PFNGLNORMALSTREAM3SATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3svATI, PFNGLNORMALSTREAM3SVATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3iATI, PFNGLNORMALSTREAM3IATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3ivATI, PFNGLNORMALSTREAM3IVATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3fATI, PFNGLNORMALSTREAM3FATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3fvATI, PFNGLNORMALSTREAM3FVATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3dATI, PFNGLNORMALSTREAM3DATIPROC, ret);
          SAFE_GET_PROC( glNormalStream3dvATI, PFNGLNORMALSTREAM3DVATIPROC, ret);

          if (ret)
          {
             GL_ATI_vertex_streams_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_vertex_streams */
    #ifdef GL_ATI_separate_stencil
       else if (0 == strcmp(extension, "GL_ATI_separate_stencil"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glStencilOpSeparateATI, PFNGLSTENCILOPSEPARATEATIPROC, ret);
          SAFE_GET_PROC( glStencilFuncSeparateATI, PFNGLSTENCILFUNCSEPARATEATIPROC, ret);

          if (ret)
          {
             GL_ATI_separate_stencil_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_separate_stencil */
    #ifdef GL_ATI_draw_buffers
       else if (0 == strcmp(extension, "GL_ATI_draw_buffers"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;

          SAFE_GET_PROC( glDrawBuffersATI, PFNGLDRAWBUFFERSATIPROC, ret);

          if (ret)
          {
             GL_ATI_draw_buffers_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ATI_draw_buffers */
    #ifdef GL_ATI_texture_mirror_once
       else if (0 == strcmp( extension, "GL_ATI_texture_mirror_once"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_ATI_texture_mirror_once_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_ATI_texture_float
       else if (0 == strcmp( extension, "GL_ATI_texture_float"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_ATI_texture_float_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_ATI_texture_env_combine3
       else if (0 == strcmp( extension, "GL_ATI_texture_env_combine3"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_ATI_texture_env_combine3_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_ATIX_texture_env_route
       else if (0 == strcmp( extension, "GL_ATIX_texture_env_route"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_ATIX_texture_env_route_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_ATIX_vertex_shader_output_point_size
       else if (0 == strcmp( extension, "GL_ATIX_vertex_shader_output_point_size"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_ATIX_vertex_shader_output_point_size_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_NV_texgen_reflection
       else if (0 == strcmp( extension, "GL_NV_texgen_reflection"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_NV_texgen_reflection_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_NV_blend_square
       else if (0 == strcmp( extension, "GL_NV_blend_square"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_NV_blend_square_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_NV_point_sprite
       else if (0 == strcmp( extension, "GL_NV_point_sprite"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;
          SAFE_GET_PROC( glPointParameteriNV, PFNGLPOINTPARAMETERINVPROC, ret);
          SAFE_GET_PROC( glPointParameterivNV, PFNGLPOINTPARAMETERIVNVPROC, ret);

          if (ret)
          {
             GL_NV_point_sprite_Flag = GL_TRUE;
          }
       }
    #endif

    #ifdef GL_ARB_occlusion_query
       else if (0 == strcmp( extension, "GL_ARB_occlusion_query"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;
    		SAFE_GET_PROC(glGenQueriesARB, PFNGLGENQUERIESARBPROC, ret);
    		SAFE_GET_PROC(glDeleteQueriesARB, PFNGLDELETEQUERIESARBPROC, ret);
    		SAFE_GET_PROC(glIsQueryARB , PFNGLISQUERYARBPROC, ret);
    		SAFE_GET_PROC(glBeginQueryARB, PFNGLBEGINQUERYARBPROC, ret);
    		SAFE_GET_PROC(glEndQueryARB, PFNGLENDQUERYARBPROC, ret);
    		SAFE_GET_PROC(glGetQueryivARB, PFNGLGETQUERYIVARBPROC, ret);
    		SAFE_GET_PROC(glGetQueryObjectivARB, PFNGLGETQUERYOBJECTIVARBPROC, ret);
    		SAFE_GET_PROC(glGetQueryObjectuivARB, PFNGLGETQUERYOBJECTUIVARBPROC, ret);

          if (ret)
          {
             GL_ARB_occlusion_query_Flag = GL_TRUE;
          }
       }
    #endif		// Updated by @RG for accomodating ARB Occlusion query.

    #ifdef GL_NV_occlusion_query
       else if (0 == strcmp( extension, "GL_NV_occlusion_query"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;
          SAFE_GET_PROC( glGenOcclusionQueriesNV, PFNGLGENOCCLUSIONQUERIESNVPROC, ret);
          SAFE_GET_PROC( glDeleteOcclusionQueriesNV, PFNGLDELETEOCCLUSIONQUERIESNVPROC, ret);
          SAFE_GET_PROC( glIsOcclusionQueryNV, PFNGLISOCCLUSIONQUERYNVPROC, ret);
          SAFE_GET_PROC( glBeginOcclusionQueryNV, PFNGLBEGINOCCLUSIONQUERYNVPROC, ret);
          SAFE_GET_PROC( glEndOcclusionQueryNV, PFNGLENDOCCLUSIONQUERYNVPROC, ret);
          SAFE_GET_PROC( glGetOcclusionQueryivNV, PFNGLGETOCCLUSIONQUERYIVNVPROC, ret);
          SAFE_GET_PROC( glGetOcclusionQueryuivNV, PFNGLGETOCCLUSIONQUERYUIVNVPROC, ret);

          if (ret)
          {
             GL_NV_occlusion_query_Flag = GL_TRUE;
          }
       }
    #endif
    #ifdef GL_HP_occlusion_test
       else if (0 == strcmp( extension, "GL_HP_occlusion_test"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_HP_occlusion_test_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_S3_s3tc
       else if (0 == strcmp( extension, "GL_S3_s3tc"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_S3_s3tc_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_SGI_texture_edge_clamp
       else if (0 == strcmp( extension, "GL_SGI_texture_edge_clamp"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_SGI_texture_edge_clamp_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_SGIS_generate_mipmap
       else if (0 == strcmp( extension, "GL_SGIS_generate_mipmap"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_SGIS_generate_mipmap_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_SGIS_texture_border_clamp
       else if (0 == strcmp( extension, "GL_SGIS_texture_border_clamp"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_SGIS_texture_border_clamp_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_SGIS_texture_lod
       else if (0 == strcmp( extension, "GL_SGIS_texture_lod"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_SGIS_texture_lod_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_SGIS_texture_lod_bias
       else if (0 == strcmp( extension, "GL_SGIS_texture_lod_bias"))
       {
          if (!extensionSupported( GLExtensionString, extension))
             return FALSE;

          GL_SGIS_texture_lod_bias_Flag = GL_TRUE;
       }
    #endif
    #ifdef GL_SGIS_multitexture
       else if (0 == strcmp(extension, "GL_SGIS_multitexture"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glSelectTextureSGIS, PFNGLSELECTTEXTURESGISPROC, ret);
          SAFE_GET_PROC( glSelectTextureTransformSGIS, PFNGLSELECTTEXTURETRANSFORMSGISPROC, ret);
          SAFE_GET_PROC( glSelectTextureCoordSetSGIS, PFNGLSELECTTEXTURECOORDSETSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1dSGIS, PFNGLMULTITEXCOORD1DSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1dvSGIS, PFNGLMULTITEXCOORD1DVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1fSGIS, PFNGLMULTITEXCOORD1FSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1fvSGIS, PFNGLMULTITEXCOORD1FVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1iSGIS, PFNGLMULTITEXCOORD1ISGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1ivSGIS, PFNGLMULTITEXCOORD1IVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1sSGIS, PFNGLMULTITEXCOORD1SSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1svSGIS, PFNGLMULTITEXCOORD1SVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2dSGIS, PFNGLMULTITEXCOORD2DSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2dvSGIS, PFNGLMULTITEXCOORD2DVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2fSGIS, PFNGLMULTITEXCOORD2FSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2fvSGIS, PFNGLMULTITEXCOORD2FVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2iSGIS, PFNGLMULTITEXCOORD2ISGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2ivSGIS, PFNGLMULTITEXCOORD2IVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2sSGIS, PFNGLMULTITEXCOORD2SSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2svSGIS, PFNGLMULTITEXCOORD2SVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3dSGIS, PFNGLMULTITEXCOORD3DSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3dvSGIS, PFNGLMULTITEXCOORD3DVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3fSGIS, PFNGLMULTITEXCOORD3FSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3fvSGIS, PFNGLMULTITEXCOORD3FVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3iSGIS, PFNGLMULTITEXCOORD3ISGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3ivSGIS, PFNGLMULTITEXCOORD3IVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3sSGIS, PFNGLMULTITEXCOORD3SSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3svSGIS, PFNGLMULTITEXCOORD3SVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4dSGIS, PFNGLMULTITEXCOORD4DSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4dvSGIS, PFNGLMULTITEXCOORD4DVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4fSGIS, PFNGLMULTITEXCOORD4FSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4fvSGIS, PFNGLMULTITEXCOORD4FVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4iSGIS, PFNGLMULTITEXCOORD4ISGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4ivSGIS, PFNGLMULTITEXCOORD4IVSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4sSGIS, PFNGLMULTITEXCOORD4SSGISPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4svSGIS, PFNGLMULTITEXCOORD4SVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1dSGIS, PFNGLMULTITEXCOORD1DSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1dvSGIS, PFNGLMULTITEXCOORD1DVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1fSGIS, PFNGLMULTITEXCOORD1FSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1fvSGIS, PFNGLMULTITEXCOORD1FVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1iSGIS, PFNGLMULTITEXCOORD1ISGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1ivSGIS, PFNGLMULTITEXCOORD1IVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1sSGIS, PFNGLMULTITEXCOORD1SSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord1svSGIS, PFNGLMULTITEXCOORD1SVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2dSGIS, PFNGLMULTITEXCOORD2DSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2dvSGIS, PFNGLMULTITEXCOORD2DVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2fSGIS, PFNGLMULTITEXCOORD2FSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2fvSGIS, PFNGLMULTITEXCOORD2FVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2iSGIS, PFNGLMULTITEXCOORD2ISGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2ivSGIS, PFNGLMULTITEXCOORD2IVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2sSGIS, PFNGLMULTITEXCOORD2SSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord2svSGIS, PFNGLMULTITEXCOORD2SVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3dSGIS, PFNGLMULTITEXCOORD3DSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3dvSGIS, PFNGLMULTITEXCOORD3DVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3fSGIS, PFNGLMULTITEXCOORD3FSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3fvSGIS, PFNGLMULTITEXCOORD3FVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3iSGIS, PFNGLMULTITEXCOORD3ISGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3ivSGIS, PFNGLMULTITEXCOORD3IVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3sSGIS, PFNGLMULTITEXCOORD3SSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord3svSGIS, PFNGLMULTITEXCOORD3SVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4dSGIS, PFNGLMULTITEXCOORD4DSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4dvSGIS, PFNGLMULTITEXCOORD4DVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4fSGIS, PFNGLMULTITEXCOORD4FSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4fvSGIS, PFNGLMULTITEXCOORD4FVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4iSGIS, PFNGLMULTITEXCOORD4ISGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4ivSGIS, PFNGLMULTITEXCOORD4IVSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4sSGIS, PFNGLMULTITEXCOORD4SSGISPROC, ret);
          SAFE_GET_PROC( glMTexCoord4svSGIS, PFNGLMULTITEXCOORD4SVSGISPROC, ret);

          if (ret)
          {
             GL_SGIS_multitexture_Flag = GL_TRUE;
          }
       }
    #endif /* GL_SGIS_multitexture */
    #ifdef GL_WIN_swap_hint
       else if (0 == strcmp(extension, "GL_WIN_swap_hint"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glAddSwapHintRectWIN, PFNGLADDSWAPHINTRECTWINPROC, ret);

          if (ret)
          {
             GL_WIN_swap_hint_Flag = GL_TRUE;
          }
       }
    #endif /* GL_WIN_swap_hint */
    #ifdef GL_KTX_buffer_region
       else if (0 == strcmp(extension, "GL_KTX_buffer_region"))
       {
          if(!extensionSupported(GLExtensionString,extension))
             return FALSE;
          SAFE_GET_PROC( glBufferRegionEnabled, PFNGLBUFFERREGIONENABLEDEXTPROC, ret);
          SAFE_GET_PROC( glNewBufferRegion, PFNGLNEWBUFFERREGIONEXTPROC, ret);
          SAFE_GET_PROC( glDeleteBufferRegion, PFNGLDELETEBUFFERREGIONEXTPROC, ret);
          SAFE_GET_PROC( glReadBufferRegion, PFNGLREADBUFFERREGIONEXTPROC, ret);
          SAFE_GET_PROC( glDrawBufferRegion, PFNGLDRAWBUFFERREGIONEXTPROC, ret);

          if (ret)
          {
             GL_KTX_buffer_region_Flag = GL_TRUE;
          }
       }
    #endif /* GL_KTX_buffer_region */
    #ifdef WGL_ARB_extensions_string
       else if (0 == strcmp(extension, "WGL_ARB_extensions_string"))
       {
          SAFE_GET_PROC( wglGetExtensionsStringARB, PFNWGLGETEXTENSIONSSTRINGARBPROC, ret);

          if (ret)
          {
             WGL_ARB_extensions_string_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_extensions_string */
    #ifdef WGL_EXT_extensions_string
       else if (0 == strcmp(extension, "WGL_EXT_extensions_string"))
       {
          SAFE_GET_PROC( wglGetExtensionsStringEXT, PFNWGLGETEXTENSIONSSTRINGEXTPROC, ret);

          if (ret)
          {
             WGL_EXT_extensions_string_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_EXT_extensions_string */
    #ifdef WGL_EXT_swap_control
       else if (0 == strcmp(extension, "WGL_EXT_swap_control"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;
          SAFE_GET_PROC( wglSwapIntervalEXT, PFNWGLSWAPINTERVALEXTPROC, ret);
          SAFE_GET_PROC( wglGetSwapIntervalEXT, PFNWGLGETSWAPINTERVALEXTPROC, ret);

          if (ret)
          {
             WGL_EXT_swap_control_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_EXT_swap_control */
    #ifdef WGL_ARB_pixel_format
       else if (0 == strcmp(extension, "WGL_ARB_pixel_format"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;
          SAFE_GET_PROC( wglGetPixelFormatAttribivARB, PFNWGLGETPIXELFORMATATTRIBIVARBPROC, ret);
          SAFE_GET_PROC( wglGetPixelFormatAttribfvARB, PFNWGLGETPIXELFORMATATTRIBFVARBPROC, ret);
          SAFE_GET_PROC( wglChoosePixelFormatARB, PFNWGLCHOOSEPIXELFORMATARBPROC, ret);

          if (ret)
          {
             WGL_ARB_pixel_format_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_pixel_format */
    #ifdef WGL_ARB_make_current_read
       else if (0 == strcmp(extension, "WGL_ARB_make_current_read"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;
          SAFE_GET_PROC( wglMakeContextCurrentARB, PFNWGLMAKECONTEXTCURRENTARBPROC, ret);
          SAFE_GET_PROC( wglGetCurrentReadDCARB, PFNWGLGETCURRENTREADDCARBPROC, ret);

          if (ret)
          {
             WGL_ARB_make_current_read_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_make_current_read */
    #ifdef WGL_ARB_pbuffer
       else if (0 == strcmp(extension, "WGL_ARB_pbuffer"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;
          SAFE_GET_PROC( wglCreatePbufferARB, PFNWGLCREATEPBUFFERARBPROC, ret);
          SAFE_GET_PROC( wglGetPbufferDCARB, PFNWGLGETPBUFFERDCARBPROC, ret);
          SAFE_GET_PROC( wglReleasePbufferDCARB, PFNWGLRELEASEPBUFFERDCARBPROC, ret);
          SAFE_GET_PROC( wglDestroyPbufferARB, PFNWGLDESTROYPBUFFERARBPROC, ret);
          SAFE_GET_PROC( wglQueryPbufferARB, PFNWGLQUERYPBUFFERARBPROC, ret);

          if (ret)
          {
             WGL_ARB_pbuffer_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_pbuffer */
    #ifdef WGL_ARB_render_texture
       else if (0 == strcmp(extension, "WGL_ARB_render_texture"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;
          SAFE_GET_PROC( wglBindTexImageARB, PFNWGLBINDTEXIMAGEARBPROC, ret);
          SAFE_GET_PROC( wglReleaseTexImageARB, PFNWGLRELEASETEXIMAGEARBPROC, ret);
          SAFE_GET_PROC( wglSetPbufferAttribARB, PFNWGLSETPBUFFERATTRIBARBPROC, ret);

          if (ret)
          {
             WGL_ARB_render_texture_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_render_texture */
    #ifdef WGL_ARB_multisample
       else if (0 == strcmp(extension, "WGL_ARB_multisample"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;

          if (ret)
          {
             WGL_ARB_multisample_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_multisample */
    #ifdef GL_ARB_shader_objects
       else if (0 == strcmp(extension, "GL_ARB_shader_objects"))
       {
          if (!extensionSupported(GLExtensionString, extension))
          {
             return FALSE;
          }

          SAFE_GET_PROC(glDeleteObjectARB, PFNGLDELETEOBJECTARBPROC, ret);
          SAFE_GET_PROC(glGetHandleARB, PFNGLGETHANDLEARBPROC, ret);
          SAFE_GET_PROC(glDetachObjectARB, PFNGLDETACHOBJECTARBPROC, ret);
          SAFE_GET_PROC(glCreateShaderObjectARB, PFNGLCREATESHADEROBJECTARBPROC, ret);
          SAFE_GET_PROC(glShaderSourceARB, PFNGLSHADERSOURCEARBPROC, ret);
          SAFE_GET_PROC(glCompileShaderARB, PFNGLCOMPILESHADERARBPROC, ret);
          SAFE_GET_PROC(glCreateProgramObjectARB, PFNGLCREATEPROGRAMOBJECTARBPROC, ret);
          SAFE_GET_PROC(glAttachObjectARB, PFNGLATTACHOBJECTARBPROC, ret);
          SAFE_GET_PROC(glLinkProgramARB, PFNGLLINKPROGRAMARBPROC, ret);
          SAFE_GET_PROC(glUseProgramObjectARB, PFNGLUSEPROGRAMOBJECTARBPROC, ret);
          SAFE_GET_PROC(glValidateProgramARB, PFNGLVALIDATEPROGRAMARBPROC, ret);
          SAFE_GET_PROC(glUniform1fARB, PFNGLUNIFORM1FARBPROC, ret);
          SAFE_GET_PROC(glUniform2fARB, PFNGLUNIFORM2FARBPROC, ret);
          SAFE_GET_PROC(glUniform3fARB, PFNGLUNIFORM3FARBPROC, ret);
          SAFE_GET_PROC(glUniform4fARB, PFNGLUNIFORM4FARBPROC, ret);
          SAFE_GET_PROC(glUniform1iARB, PFNGLUNIFORM1IARBPROC, ret);
          SAFE_GET_PROC(glUniform2iARB, PFNGLUNIFORM2IARBPROC, ret);
          SAFE_GET_PROC(glUniform3iARB, PFNGLUNIFORM3IARBPROC, ret);
          SAFE_GET_PROC(glUniform4iARB, PFNGLUNIFORM4IARBPROC, ret);
          SAFE_GET_PROC(glUniform1fvARB, PFNGLUNIFORM1FVARBPROC, ret);
          SAFE_GET_PROC(glUniform2fvARB, PFNGLUNIFORM2FVARBPROC, ret);
          SAFE_GET_PROC(glUniform3fvARB, PFNGLUNIFORM3FVARBPROC, ret);
          SAFE_GET_PROC(glUniform4fvARB, PFNGLUNIFORM4FVARBPROC, ret);
          SAFE_GET_PROC(glUniform1ivARB, PFNGLUNIFORM1IVARBPROC, ret);
          SAFE_GET_PROC(glUniform2ivARB, PFNGLUNIFORM2IVARBPROC, ret);
          SAFE_GET_PROC(glUniform3ivARB, PFNGLUNIFORM3IVARBPROC, ret);
          SAFE_GET_PROC(glUniform4ivARB, PFNGLUNIFORM4IVARBPROC, ret);
          SAFE_GET_PROC(glUniformMatrix2fvARB, PFNGLUNIFORMMATRIX2FVARBPROC, ret);
          SAFE_GET_PROC(glUniformMatrix3fvARB, PFNGLUNIFORMMATRIX3FVARBPROC, ret);
          SAFE_GET_PROC(glUniformMatrix4fvARB, PFNGLUNIFORMMATRIX4FVARBPROC, ret);
          SAFE_GET_PROC(glGetObjectParameterfvARB, PFNGLGETOBJECTPARAMETERFVARBPROC, ret);
          SAFE_GET_PROC(glGetObjectParameterivARB, PFNGLGETOBJECTPARAMETERIVARBPROC, ret);
          SAFE_GET_PROC(glGetInfoLogARB, PFNGLGETINFOLOGARBPROC, ret);
          SAFE_GET_PROC(glGetAttachedObjectsARB, PFNGLGETATTACHEDOBJECTSARBPROC, ret);
          SAFE_GET_PROC(glGetUniformLocationARB, PFNGLGETUNIFORMLOCATIONARBPROC, ret);
          SAFE_GET_PROC(glGetActiveUniformARB, PFNGLGETACTIVEUNIFORMARBPROC, ret);
          SAFE_GET_PROC(glGetUniformfvARB, PFNGLGETUNIFORMFVARBPROC, ret);
          SAFE_GET_PROC(glGetUniformivARB, PFNGLGETUNIFORMIVARBPROC, ret);
          SAFE_GET_PROC(glGetShaderSourceARB, PFNGLGETSHADERSOURCEARBPROC, ret);

          if (ret)
          {
             GL_ARB_shader_objects_Flag = GL_TRUE;
          }
       }
    #endif /* GL_ARB_shader_objects */

    #ifdef GL_ARB_vertex_shader
       else if (0 == strcmp(extension, "GL_ARB_vertex_shader"))
       {
          if (!extensionSupported(GLExtensionString,extension))
          {
             return FALSE;
          }

          SAFE_GET_PROC(glBindAttribLocationARB, PFNGLBINDATTRIBLOCATIONARBPROC, ret);
          SAFE_GET_PROC(glGetActiveAttribARB, PFNGLGETACTIVEATTRIBARBPROC, ret);
          SAFE_GET_PROC(glGetAttribLocationARB, PFNGLGETATTRIBLOCATIONARBPROC, ret);

          if (ret)
          {
             GL_ARB_vertex_shader_Flag = GL_TRUE;
          }
       }
    #endif // GL_ARB_vertex_shader

    #ifdef GL_ARB_fragment_shader
       else if (0 == strcmp(extension, "GL_ARB_fragment_shader"))
       {
          if (!extensionSupported(GLExtensionString,extension))
          {
             return FALSE;
          }

          GL_ARB_fragment_shader_Flag = GL_TRUE;
       }
    #endif // GL_ARB_fragment_shader

    #ifdef WGL_ATI_pixel_format_float
       else if (0 == strcmp(extension, "WGL_ATI_pixel_format_float"))
       {
          if((NULL == wglGetExtensionsStringARB) ||
             (!extensionSupported(WGLExtensionString,extension)))
             return FALSE;

          if (ret)
          {
             WGL_ATI_pixel_format_float_Flag = GL_TRUE;
          }
       }
    #endif /* WGL_ARB_render_texture */

       else
       {
          return FALSE;
       }
       return ret;
    }

    int SetupExtensionsFromString(const char * OrigExtensionString)
    {
       char *ExtensionString;
       unsigned int StrLen = strlen(OrigExtensionString);
       char * Extension;
       int ret = TRUE;

       if ( !(ExtensionString = (char*) malloc( StrLen+1)))
       {
          return FALSE;
       }

       /* Convert From 'const char *' to 'char *' */

       strcpy(ExtensionString, OrigExtensionString);

       /* Setup All the Extensions in this string */
       Extension = strtok( ExtensionString, " ");
       while( Extension != NULL )
       {
          if(!SetupExtension(Extension))
          {
             ret = FALSE;
          }
          Extension = strtok( NULL, " ");
       }

       free(ExtensionString);

       return ret;
    }

    /* Initialize GL 1.2 entrypoints */
    int SetupGL1_2()
    {
       int majorVersion;
       int minorVersion;
       const char* version;
       int ret = TRUE;

       version = (const char*)glGetString(GL_VERSION);
       majorVersion = atoi(version);
       version = strchr( version, '.');
       version++;
       minorVersion = atoi(version);

       /* check for 1.2 version string */
       if ( (majorVersion == 1) && (minorVersion >=2))
       {
          /* 3D texture */
          SAFE_GET_PROC( glTexImage3D, PFNGLTEXIMAGE3DEXTPROC, ret);
          SAFE_GET_PROC( glTexSubImage3D, PFNGLTEXSUBIMAGE3DPROC, ret);
          SAFE_GET_PROC( glCopyTexSubImage3D, PFNGLCOPYTEXSUBIMAGE3DPROC, ret);

          /* Draw range elements */
          SAFE_GET_PROC( glDrawRangeElements, PFNGLDRAWRANGEELEMENTSEXTPROC, ret);

          return ret;
       }

       return FALSE;
    }

    /* Initialize GL 1.3 entrypoints */
    int SetupGL1_3()
    {
       int majorVersion;
       int minorVersion;
       const char* version;
       int ret = TRUE;

       version = (const char*)glGetString(GL_VERSION);
       majorVersion = atoi(version);
       version = strchr( version, '.');
       version++;
       minorVersion = atoi(version);

       /* check for 1.3 version string */
       if ((majorVersion == 1) && (minorVersion >=3))
       {

          /* multitexture */
          SAFE_GET_PROC( glActiveTexture, PFNGLACTIVETEXTUREARBPROC, ret);
          SAFE_GET_PROC( glClientActiveTexture, PFNGLCLIENTACTIVETEXTUREARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1d, PFNGLMULTITEXCOORD1DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1dv, PFNGLMULTITEXCOORD1DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1f, PFNGLMULTITEXCOORD1FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1fv, PFNGLMULTITEXCOORD1FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1i, PFNGLMULTITEXCOORD1IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1iv, PFNGLMULTITEXCOORD1IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1s, PFNGLMULTITEXCOORD1SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord1sv, PFNGLMULTITEXCOORD1SVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2d, PFNGLMULTITEXCOORD2DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2dv, PFNGLMULTITEXCOORD2DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2f, PFNGLMULTITEXCOORD2FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2fv, PFNGLMULTITEXCOORD2FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2i, PFNGLMULTITEXCOORD2IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2iv, PFNGLMULTITEXCOORD2IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2s, PFNGLMULTITEXCOORD2SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord2sv, PFNGLMULTITEXCOORD2SVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3d, PFNGLMULTITEXCOORD3DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3dv, PFNGLMULTITEXCOORD3DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3f, PFNGLMULTITEXCOORD3FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3fv, PFNGLMULTITEXCOORD3FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3i, PFNGLMULTITEXCOORD3IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3iv, PFNGLMULTITEXCOORD3IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3s, PFNGLMULTITEXCOORD3SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord3sv, PFNGLMULTITEXCOORD3SVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4d, PFNGLMULTITEXCOORD4DARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4dv, PFNGLMULTITEXCOORD4DVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4f, PFNGLMULTITEXCOORD4FARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4fv, PFNGLMULTITEXCOORD4FVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4i, PFNGLMULTITEXCOORD4IARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4iv, PFNGLMULTITEXCOORD4IVARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4s, PFNGLMULTITEXCOORD4SARBPROC, ret);
          SAFE_GET_PROC( glMultiTexCoord4sv, PFNGLMULTITEXCOORD4SVARBPROC, ret);

          /* transpose matrix */
          SAFE_GET_PROC( glLoadTransposeMatrixf, PFNGLLOADTRANSPOSEMATRIXFARBPROC, ret);
          SAFE_GET_PROC( glLoadTransposeMatrixd, PFNGLLOADTRANSPOSEMATRIXDARBPROC, ret);
          SAFE_GET_PROC( glMultTransposeMatrixf, PFNGLMULTTRANSPOSEMATRIXFARBPROC, ret);
          SAFE_GET_PROC( glMultTransposeMatrixd, PFNGLMULTTRANSPOSEMATRIXDARBPROC, ret);

          /* Compressed texture */
          SAFE_GET_PROC( glCompressedTexImage3D, PFNGLCOMPRESSEDTEXIMAGE3DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexImage2D, PFNGLCOMPRESSEDTEXIMAGE2DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexImage1D, PFNGLCOMPRESSEDTEXIMAGE1DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexSubImage3D, PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexSubImage2D, PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC, ret);
          SAFE_GET_PROC( glCompressedTexSubImage1D, PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC, ret);
          SAFE_GET_PROC( glGetCompressedTexImage, PFNGLGETCOMPRESSEDTEXIMAGEARBPROC, ret);

    	  /* Multisample */
          SAFE_GET_PROC( glSampleCoverage, PFNGLSAMPLECOVERAGEARBPROC, ret);

          return SetupGL1_2() && ret;
       }

       return FALSE;
    }

    /* Initialize GL 1.4 entrypoints */
    int SetupGL1_4()
    {
       int majorVersion;
       int minorVersion;
       const char* version;
       int ret = TRUE;

       version = (const char*)glGetString(GL_VERSION);
       majorVersion = atoi(version);
       version = strchr( version, '.');
       version++;
       minorVersion = atoi(version);

       /* check for 1.4 version string */
       if ((majorVersion == 1) && (minorVersion >=4))
       {
          /* point parameter */
          SAFE_GET_PROC( glPointParameterf, PFNGLPOINTPARAMETERFEXTPROC, ret);
          SAFE_GET_PROC( glPointParameterfv, PFNGLPOINTPARAMETERFVEXTPROC, ret);

          /* secondary color */
          SAFE_GET_PROC( glSecondaryColor3f, PFNGLSECONDARYCOLOR3FEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3d, PFNGLSECONDARYCOLOR3DEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3b, PFNGLSECONDARYCOLOR3BEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3s, PFNGLSECONDARYCOLOR3SEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3i, PFNGLSECONDARYCOLOR3IEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3ub, PFNGLSECONDARYCOLOR3UBEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3us, PFNGLSECONDARYCOLOR3USEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3ui, PFNGLSECONDARYCOLOR3UIEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3fv, PFNGLSECONDARYCOLOR3FVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3dv, PFNGLSECONDARYCOLOR3DVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3bv, PFNGLSECONDARYCOLOR3BVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3sv, PFNGLSECONDARYCOLOR3SVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3iv, PFNGLSECONDARYCOLOR3IVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3ubv, PFNGLSECONDARYCOLOR3UBVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3usv, PFNGLSECONDARYCOLOR3USVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColor3uiv, PFNGLSECONDARYCOLOR3UIVEXTPROC, ret);
          SAFE_GET_PROC( glSecondaryColorPointer, PFNGLSECONDARYCOLORPOINTEREXTPROC, ret);

          /* fog coord */
          SAFE_GET_PROC( glFogCoordf, PFNGLFOGCOORDFEXTPROC, ret);
          SAFE_GET_PROC( glFogCoordd, PFNGLFOGCOORDDEXTPROC, ret);
          SAFE_GET_PROC( glFogCoordfv, PFNGLFOGCOORDFVEXTPROC, ret);
          SAFE_GET_PROC( glFogCoorddv, PFNGLFOGCOORDDVEXTPROC, ret);
          SAFE_GET_PROC( glFogCoordPointer, PFNGLFOGCOORDPOINTEREXTPROC, ret);

          /* window pos */
          SAFE_GET_PROC( glWindowPos2d, PFNGLWINDOWPOS2DARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2f, PFNGLWINDOWPOS2FARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2i, PFNGLWINDOWPOS2IARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2s, PFNGLWINDOWPOS2SARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2iv, PFNGLWINDOWPOS2IVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2sv, PFNGLWINDOWPOS2SVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2fv, PFNGLWINDOWPOS2FVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos2dv, PFNGLWINDOWPOS2DVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3i, PFNGLWINDOWPOS3IARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3s, PFNGLWINDOWPOS3SARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3f, PFNGLWINDOWPOS3FARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3d, PFNGLWINDOWPOS3DARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3iv, PFNGLWINDOWPOS3IVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3sv, PFNGLWINDOWPOS3SVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3fv, PFNGLWINDOWPOS3FVARBPROC, ret);
          SAFE_GET_PROC( glWindowPos3dv, PFNGLWINDOWPOS3DVARBPROC, ret);

          /* blend Func separate */
          SAFE_GET_PROC( glBlendFuncSeparate, PFNGLBLENDFUNCSEPARATEEXTPROC, ret);

          /* multi draw arrays */
          SAFE_GET_PROC( glMultiDrawArraysEXT, PFNGLMULTIDRAWARRAYSEXTPROC, ret);
          SAFE_GET_PROC( glMultiDrawElements, PFNGLMULTIDRAWELEMENTSEXTPROC, ret);

          return SetupGL1_3() && ret;
       }

       return FALSE;
    }

    /* Initialize standard WGL extensions */
    int SetupWGLExtensions()
    {
       static char wgl[] = "WGL_ARB_extensions_string WGL_ARB_pbuffer WGL_ARB_render_texture WGL_ARB_make_current_read "
          "WGL_ARB_pixel_format WGL_EXT_swap_control";

       return SetupExtensionsFromString(wgl);
    }

    int SetupARBExtensions()
    {
       static char arb[] = "GL_ARB_vertex_buffer_object GL_ARB_occlusion_query GL_ARB_multitexture GL_ARB_transpose_matrix GL_ARB_multisample GL_ARB_texture_env_add "
          "GL_ARB_texture_cube_map GL_ARB_texture_compression GL_ARB_texture_border_clamp GL_ARB_point_parameters "
          "GL_ARB_vertex_blend GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 "
          "GL_ARB_texture_mirrored_repeat GL_ARB_depth_texture GL_ARB_shadow GL_ARB_shadow_ambient "
          "GL_ARB_window_pos GL_ARB_vertex_program GL_ARB_fragment_program GL_ARB_point_sprite GL_ARB_fragment_shader_Flag"
    	  "GL_ARB_vertex_shader_Flag GL_ARB_shader_objects_Flag";
    			// Updated by @RG for accomodating ARB Occlusion query.
    			// Updated by @RG Mar 23 2005, Added GL_ARB_vertex_buffer_object.
    			// THis code needs to be rewritten. Actually one needs to set up this string dynamically instead of static
    			// updation everytime. A runtime error is shocking.

       return SetupExtensionsFromString(arb);
    }

    int SetupEXTExtensions()
    {
       static char ext[] = "GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture_object GL_EXT_fog_coord "
          "GL_EXT_secondary_color GL_EXT_draw_range_elements GL_EXT_texture3D GL_EXT_point_parameters "
          "GL_EXT_vertex_shader GL_EXT_blend_minmax GL_EXT_blend_func_subtract GL_EXT_blend_color GL_EXT_texture_rectangle";

       return SetupExtensionsFromString(ext);
    }

    int SetupATIExtensions()
    {
       static char ati[] = "GL_ATI_vertex_streams GL_ATI_envmap_bumpmap GL_ATI_vertex_array_object "
          "GL_ATI_element_array GL_ATI_fragment_shader GL_ATI_separate_stencil GL_ATI_draw_buffers "
          "GL_ATI_texture_mirror_once GL_ATI_texture_float GL_ATI_texture_env_combine3 GL_ATI_vertex_attrib_array_object "
          "GL_ATI_pn_triangles";

       return SetupExtensionsFromString(ati);
    }

    int SetupGLSLExtensions()
    {
       static char gl2[] = "GL_ARB_shader_objects GL_ARB_vertex_shader GL_ARB_fragment_shader";

       return SetupExtensionsFromString(gl2);
    }

    #undef SAFE_GET_PROC

    ¡¡

    file name: shader.h (downloaded and modified)

    /****************************************************************************************/
    /*
    /* Shader class header file.
    /* DATED 4th Oct 2004		RAMGOPAL R		r_rajago@cs.concordia.ca
    /*                          LEVITT R		roanne.levitt@engenuitytech.com
    /* Updated	6-Dec-05
    /****************************************************************************************/

    #ifndef _SHADER_H_
    #define _SHADER_H_

    #include <string>

    #include <sys/stat.h>
    #include <assert.h>
    #include <vector>

    #include <GL/glut.h>
    //#include "glext.h"
    #include "extsetup.h"

    using namespace std;

    void getLastError();

    class CLightDef {
    		public:
    		  CLightDef(unsigned int iId,
    					float x,  float y,  float z, float w,
    			        float iR, float iG, float iB, float iA = 1.0,
    					float exp = 32.0)
    			  {
    				  id = iId;

    				  setPos( x,y,z,w );
    				  setRGBA(iR, iG, iB, iA);
    				  setExponent( exp );
    			  };

    		      void getPos( float &x, float &y, float &z, float &w) {
    				  x = pos[0];
    				  y = pos[1];
    				  z = pos[2];
    				  w = pos[3];
    			  };

    			  void setPos( float x, float y, float z, float w) {
    				  pos[0] = x;
    				  pos[1] = y;
    				  pos[2] = z;
    				  pos[3] = w;
    			  };

    			  void getRGBA( float &oR, float &oG, float &oB, float &oA) {
    				  oR = r;
    				  oG = g;
    				  oB = b;
    				  oA = a;
    			  };

    			  void setRGBA(float iR, float iG, float iB, float iA)
    			  {
    				  r = min( max( 0.0, iR ), 1.0 );
    				  g = min( max( 0.0, iG ), 1.0 );
    				  b = min( max( 0.0, iB ), 1.0 );
    				  a = min( max( 0.0, iA ), 1.0 );
    			  };

    			  float getExponent() { return exponent; };
    			  void setExponent(float exp )
    			  {
    				  exponent = min( max( exp, -128.0), 128.0) ;
    			  };

    			unsigned int id;
    			float r, g, b, a;
    			float pos[4];
    			float exponent;
    };

    class CShader
    {
    public:
    	CShader();
    	~CShader();

    	void setShaderConstants	(unsigned int whichShader);
    	void initShader			(void );
    	void selectShader		(unsigned int whichShader);
    	void reLoadShader		(unsigned int whichShader);
    	void reLoadAllShaders	();
    	void loadShader			(unsigned int whichShader );
    	CLightDef &getLightDef  (unsigned int whichLight);
    	unsigned int getNbrLights() {return lightList.size();};
    	void updateLights       ();

    	unsigned int getNbrShaders() { return nbrShaderFiles; }
    	string getShaderName(unsigned int whichShader);
    	unsigned int getShaderNdx(string shaderName);
    	unsigned int getShaderNdx(); // overloaded - returns current shader

    	void getGlError			(const string str = NULL, bool abort = true);
    	GLint preMatrixLocation;
    	GLint tickingLocation;
    	float preMatrix[16];

    	GLhandleARB    shaderProgramHandle;
    	GLhandleARB    *vertexProgramID;
    	GLhandleARB    *fragmentProgramID;
    	string	  *vertexShaderFiles;
    	string    *fragmentShaderFiles;
    	string	  *shaderNames;
    	unsigned int nbrShaderFiles;
    	int currentShader;
    	char* sourceCode;

    	void deleteShader(unsigned int whichShader);
    	unsigned char * readShaderFile( const char *fileName );
    	void loadAllShaders(); // RL
    	void loadShaderFile(const char* fileName, GLhandleARB &shaderHandle, GLenum shaderType);

    	// List of all lights
    	vector<CLightDef> lightList;
    };

    #endif //_SHADER_H_

    ¡¡

    ¡¡

    file name: shader.cpp (downloaded and modified)

    /****************************************************************************************/
    /* Shader Test Bed.
    /* DATED 4th Oct 2004
    							RAMGOPAL R		r_rajago@cs.concordia.ca
    /*                          LEVITT R		roanne.levitt@engenuitytech.com
    /* Updated 6-Dec-05
    /****************************************************************************************/

    #pragma warning(disable: 4786)

    #include "shader.h"
    #include "extsetup.h"
    #include <vector>
    #include <string>
    #include <iostream>

    char buffer[256];
    int length;

    void getLastError()
    {
    	GLenum err;
    	char msg[256];
    	err=glGetError();
    	switch(err)
    	{
    	case GL_NO_ERROR:
    		sprintf(msg, "GL_NO_ERROR");
    		break;
    	case GL_INVALID_ENUM:
    		sprintf(msg, "GL_INVALID_ENUM");
    		break;
    	case GL_INVALID_VALUE:
    		sprintf(msg, "GL_INVALID_VALUE");
    		break;
    	case GL_INVALID_OPERATION:
    		sprintf(msg, "GL_INVALID_OPERATION");
    		break;
    	case GL_STACK_OVERFLOW:
    		sprintf(msg, "GL_STACK_OVERFLOW");
    		break;
    	case GL_STACK_UNDERFLOW:
    		sprintf(msg, "GL_STACK_UNDERFLOW");
    		break;
    	case GL_OUT_OF_MEMORY:
    		sprintf(msg, "GL_OUT_OF_MEMORY");
    		break;
    	}
    	if (err!=GL_NO_ERROR)
    	{
    		printf("error message %s\n", msg);
    		exit(err);
    	}
    }

    //-----------------------------------------------------------------------------
    // Name: CShader() constructor
    // Desc: Initializations
    //-----------------------------------------------------------------------------
    CShader::CShader()
    {
    	/*
    	PFNGLGENPROGRAMSARBPROC           glGenProgramsARB           = NULL;
    	PFNGLDELETEPROGRAMSARBPROC        glDeleteProgramsARB        = NULL;
    	PFNGLBINDPROGRAMARBPROC           glBindProgramARB           = NULL;
    	PFNGLPROGRAMSTRINGARBPROC         glProgramStringARB         = NULL;
    	PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL;
    */
    	const string vertexExt(".Vert");
    	const string fragmentExt(".Frag");

    	// Compile a list of vertex shader files.
    	WIN32_FIND_DATA ffd;
    	vector<string> vecFilenames;
    	string strShaderDir(".\\shaders\\");

    	HANDLE h = ::FindFirstFile((strShaderDir + "*" + vertexExt).c_str(), &ffd);
    	vecFilenames.push_back(string(ffd.cFileName));
    	while (::FindNextFile(h, &ffd))
    		vecFilenames.push_back(string(ffd.cFileName));
    	::FindClose(h);

    	// Allocate memory
    	// Store the list of vertex shader files
    	// Assume corresponding fragment shaders exist
    	nbrShaderFiles = vecFilenames.size();

    	vertexProgramID     = new GLhandleARB[nbrShaderFiles];
    	fragmentProgramID   = new GLhandleARB[nbrShaderFiles];

    	vertexShaderFiles   = new string[nbrShaderFiles];
    	fragmentShaderFiles = new string[nbrShaderFiles];
    	shaderNames         = new string[nbrShaderFiles];

    	for (unsigned int i = 0; i < nbrShaderFiles; i++ ) {
    		vertexProgramID[i] = 0;
    		fragmentProgramID[i] = 0;

    		vertexShaderFiles[i] = strShaderDir + vecFilenames[i]; // Store vertex filename
    		const int replNdx = vecFilenames[i].length() - vertexExt.length(); // start replacement index
    		shaderNames[i] = vecFilenames[i];
    		shaderNames[i].erase(replNdx, vertexExt.length()); // Remove fragment ending
    		vecFilenames[i] = shaderNames[i] + fragmentExt; // Replace Vert with Frag
    		fragmentShaderFiles[i] = strShaderDir + vecFilenames[i];
    	}

    	currentShader = -1;
    };

    //-----------------------------------------------------------------------------
    // Name: getShaderName()
    // Desc: Get the name of this shader to display in the menu
    //-----------------------------------------------------------------------------
    string CShader::getShaderName(unsigned int whichShader)
    {
    	if (whichShader >= 	nbrShaderFiles) {
    		MessageBox(NULL,"Invalid shader identified provided.", "Error", MB_OK);
    		return NULL;
    	}

    	return shaderNames[whichShader];
    }

    //-----------------------------------------------------------------------------
    // Name: getShaderNdx()
    // Desc: Find the index associated with the shader name provided.
    //       If an index is not found, 0 is returned.
    //-----------------------------------------------------------------------------
    unsigned int CShader::getShaderNdx(string shaderName)
    {
    	for (unsigned int i =0; i < nbrShaderFiles; i++) {
    		if (shaderName == shaderNames[i]) return i;
    	}
    	return 0;
    }

    //-----------------------------------------------------------------------------
    // Name: getShaderNdx()
    // Desc: Returns the index of the current shader
    //-----------------------------------------------------------------------------
    unsigned int CShader::getShaderNdx()
    {
    	return currentShader;
    }

    //-----------------------------------------------------------------------------
    // Name: selectShader()
    // Desc: Select a shader
    //-----------------------------------------------------------------------------
    void CShader ::selectShader(unsigned int whichShader)
    {
    	if (whichShader >= 	nbrShaderFiles)
    	{
    		MessageBox(NULL, "The shader selected is not valid", "Shader not available", MB_OK);
    		return;
    	}
    	if (currentShader!=-1)
    	{
    		glDetachObjectARB(shaderProgramHandle, vertexProgramID[currentShader]);
    		glDetachObjectARB(shaderProgramHandle, fragmentProgramID[currentShader]);
    		getLastError();
    	}

    	if (vertexProgramID[whichShader])
    	{
    		glAttachObjectARB(shaderProgramHandle, vertexProgramID[whichShader] );
    	}
    	else
    	{
    		MessageBox(NULL, "Vertex shader selected does not exist.", "Invalid Shader", MB_OK );

    	}

    	if (fragmentProgramID[whichShader])
    	{
    		glAttachObjectARB( shaderProgramHandle, fragmentProgramID[whichShader] );
    	}
    	else
    	{
    		MessageBox(NULL, "Fragment shader selected does not exist.", "Invalid Shader", MB_OK );

    	}
    	glLinkProgramARB(shaderProgramHandle);
    	getLastError();
    	glGetInfoLogARB(shaderProgramHandle, 256, &length, buffer);
    	buffer[length]='\0';
    	printf("link log is %s\n", buffer);
    	glUseProgramObjectARB(shaderProgramHandle);
    	getLastError();
    	currentShader = whichShader;
    	if (strcmp("MotionBlur", shaderNames[currentShader].c_str())==0)
    	{
    		preMatrixLocation=glGetUniformLocationARB(shaderProgramHandle, "preMatrix");

    	}
    	if (strcmp("ripple", shaderNames[currentShader].c_str())==0)
    	{
    		tickingLocation=glGetUniformLocationARB(shaderProgramHandle, "ticking");
    	}
    	getLastError();
    	glutPostRedisplay();
    }

    //-----------------------------------------------------------------------------
    // Name: deleteShader()
    // Desc: Delete the selected shader
    //-----------------------------------------------------------------------------
    void CShader ::deleteShader(unsigned int whichShader)
    {
    	if (vertexProgramID[whichShader]) {
    		glDeleteProgramsARB( 1, &(vertexProgramID[whichShader]) );
    		vertexProgramID[whichShader] = NULL;
    	}
    	if (fragmentProgramID[whichShader]) {
    		glDeleteProgramsARB( 1, &(fragmentProgramID[whichShader]) );
    		fragmentProgramID[whichShader] = NULL;
    	}
    }
    //-----------------------------------------------------------------------------
    // Name: reLoadAllShaders()
    // Desc: Reloads all shaders from file
    //-----------------------------------------------------------------------------
    void CShader::reLoadAllShaders()
    {
    	for (unsigned int i = 0; i < nbrShaderFiles; i++ ) {
    		deleteShader(i);
    		loadShader(i);
    	}
    	selectShader(currentShader);

        glutPostRedisplay();
    }

    //-----------------------------------------------------------------------------
    // Name: reLoadShader()
    // Desc: Reloads the shader from file\
    //-----------------------------------------------------------------------------
    void CShader::reLoadShader(unsigned int whichShader)
    {
       deleteShader(whichShader);
       loadShader(whichShader);
    }

    //-----------------------------------------------------------------------------
    // Name: setShaderConstants()
    // Desc:
    //-----------------------------------------------------------------------------
    void CShader ::setShaderConstants(unsigned int whichShader)
    {

    	// If needed!
    }

    //-----------------------------------------------------------------------------
    // Name: readShaderFile()
    // Desc: Reads a shader file from disk.
    //-----------------------------------------------------------------------------
    unsigned char * CShader :: readShaderFile( const char *fileName )
    {
        FILE *file = fopen( fileName, "r" );

        if( file == NULL )
        {
            //MessageBox( NULL, "Cannot open shader file!", "ERROR",
            //    MB_OK | MB_ICONEXCLAMATION );
    		return 0;
        }

        struct _stat fileStats;

        if( _stat( fileName, &fileStats ) != 0 )
        {
            MessageBox( NULL, "Cannot get file stats for shader file!", "ERROR",
                        MB_OK | MB_ICONEXCLAMATION );
            return 0;
        }

        unsigned char *buffer = new unsigned char[fileStats.st_size+1];

    	int bytes = fread( buffer, 1, fileStats.st_size, file );

        buffer[bytes] = 0;

    	fclose( file );

    	return buffer;
    }

    //-----------------------------------------------------------------------------
    // Name: initShader()
    // Desc: Assemble the shader
    //-----------------------------------------------------------------------------
    void CShader :: initShader( void )
    {
    	GLint location;
    	SetupARBExtensions();
    	SetupGLSLExtensions();

    	shaderProgramHandle=glCreateProgramObjectARB();
    	// Instantiate 2 lights (for now) and pass them on to the shaders
    	CLightDef *lightDef = new CLightDef( lightList.size(),
    		0.5, 0.5, 0.5, 1.0, /* XYZW */
    		0.8, 0.0, 0.1, 1.0 /* RGBA */ );

    	assert(lightDef);
    	lightList.push_back(*lightDef);

    	lightDef = new CLightDef( lightList.size(),
    		-0.5, 0.5, 0.5, 1.0, /* XYZW */
    		0.5, 0.5, 0.5, 1.0  /* RGBA */ );
    	lightList.push_back(*lightDef);

        // update light descriptions for shaders
    	updateLights();

    	//
    	// Create all vertex and fragment shader programs...
    	//
    	loadAllShaders();

    	// Select the Phong shader (if it exists)
    	unsigned int ndx = getShaderNdx("MotionBlur");
    	selectShader(ndx);

    	location=glGetUniformLocationARB(shaderProgramHandle, "LightPosition");
    	getLastError();
    	glUniform4fvARB(location, 1, lightList[0].pos);
    	getLastError();

    }

    //-----------------------------------------------------------------------------
    // Name: getLightDef
    // Desc: Find the light def structure for the light requested
    //-----------------------------------------------------------------------------
    CLightDef &CShader::getLightDef(unsigned int whichLight )
    {
    	if (whichLight < lightList.size()) {
    		return lightList[whichLight];
    	} else if (lightList.size() == 0) {
         	// Need to add a light
           CLightDef *lightDef = new CLightDef( lightList.size(),
    		   -0.5, 0.5, 0.5, 1.0, /* XYZW */
    		   0.5, 0.5, 0.5, 1.0  /* RGBA */ );
    	   lightList.push_back(*lightDef);
    	}

    	return lightList[0];
    }

    void CShader::updateLights()
    {
    	// Set up environment parameters for shader lights
    	// This will consist of 2 lights
    	//
        // index	meaning		values
    	// =====    =======     =======
    	//  0       LIGHT0_POS	eye-space light position
    	//  1       LIGHT0_COL  light color
    	//  2       LIGHT1_POS  eye-space light position for 2nd light
    	//  3       LIGHT1_COL  light color for 2nd light
    	//  Specular Exponent is stored in position "w" parameter
    	for (unsigned int i = 0; i < lightList.size(); i++) {
    		CLightDef &l = lightList[i];
    		float x, y, z, w;
    		float r, g, b, a;
    		l.getPos(x, y, z, w);
    		l.getRGBA(r, g, b, a);

    		glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, 2*i,   x, y, z, l.getExponent() );
    		glProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, 2*i+1, r, g, b, a );
    	}
    }

    //-----------------------------------------------------------------------------
    // Name: loadAllShaders
    // Desc: Load in all shaders.
    //-----------------------------------------------------------------------------
    void CShader::loadAllShaders()
    {
    	for (unsigned int i = 0; i < nbrShaderFiles; i++ )
    	{
    		loadShader(i);
    	}

    }

    //-----------------------------------------------------------------------------
    // Name: loadShader(whichShader)
    // Desc: Load in the selected shader.
    //-----------------------------------------------------------------------------
    void CShader::loadShader(unsigned int whichShader)
    {
    	if (whichShader < nbrShaderFiles) {

    		if (!vertexProgramID[whichShader]) {
    		   loadShaderFile(vertexShaderFiles[whichShader].c_str(),
    				vertexProgramID[whichShader],
    				GL_VERTEX_SHADER_ARB);
    		}

    		// Check for errors
    		getGlError("Load vertex shader : " + getShaderName(whichShader) + "\n\n", false);

    		if (!fragmentProgramID[whichShader]) {
    		   loadShaderFile(fragmentShaderFiles[whichShader].c_str(),
    				fragmentProgramID[whichShader],
    				GL_FRAGMENT_SHADER_ARB );
    		}
    		// Check for errors
    		getGlError("Load fragment shader: " + getShaderName(whichShader) + "\n\n", false);

    	}
    }

    void CShader::loadShaderFile(const char* fileName, GLhandleARB &shaderHandle, GLenum shaderType)
    {
    	FILE* stream;

    	struct _stat fileStatus;
    	int temp=0;

    	stream=fopen(fileName, "r+b");

    	if (_stat(fileName, &fileStatus)!=0)
    	{
    		printf("open file status fails\n");
    		exit(1);
    	}
    	sourceCode=new char[fileStatus.st_size+1];

    	if (sourceCode==NULL)
    	{
    		printf("new fails\n");
    		exit(2);
    	}
    	if ((temp=fread(sourceCode, 1, fileStatus.st_size, stream))!=fileStatus.st_size)
    	{
    			printf("read source code fails\n");
    			exit(3);
    	}

    	sourceCode[temp]='\0';
    	shaderHandle= glCreateShaderObjectARB(shaderType);
    	getLastError();
    	glShaderSourceARB(shaderHandle, 1, const_cast<const char**>(&sourceCode), NULL);
    	getLastError();
    	glCompileShaderARB(shaderHandle);
    	getLastError();
    	glGetInfoLogARB(shaderHandle, 256, &length, buffer);
    	getLastError();
    	buffer[length]='\0';
    	printf("compile log %s\n", buffer);

    	fclose(stream);
    	delete [] sourceCode;
    }

    /*
    //-----------------------------------------------------------------------------
    // Name: loadShaderFile()
    // Desc: Load in the shader file. Return the shader ID in shaderID
    //-----------------------------------------------------------------------------
    void CShader::loadShaderFile( const string shaderFile, GLuint& shaderID,
    							 GLenum shaderType )
    {
    	// Initialize shaderID
    	*shaderID = 0;

    	// Generate a program object handle
    	glGenProgramsARB( 1, shaderID ); //this is for CG
    	//shaderID=createShader(shaderFile, shaderID, shaderType);

    	// Check for errors
    	getGlError("glGenProgramsARB : " + shaderFile + "\n\n", false);

    	// Make the 'current' program object this one
    	glBindProgramARB( shaderType, *shaderID );

    	// Check for errors
    	getGlError("glBindProgramARB : " + shaderFile + "\n\n", false);

    	// Read in the shader file
    	unsigned char *shader_assembly = readShaderFile( shaderFile.c_str() );

    	// Check for errors
    	getGlError(shaderFile + "\n\n", false);

    	if (shader_assembly) {
    		// Specify the sharder program (just read in) for the current object
    		glProgramStringARB( shaderType, GL_PROGRAM_FORMAT_ASCII_ARB,
    			strlen((char*) shader_assembly), shader_assembly );

    		// Check for errors
    		getGlError("glProgramStringARB : " + shaderFile + "\n\n", false);

    		// Free up buffer memory
    		delete [] shader_assembly;
    	} else {
    		const string strMsg = "Unable to load file " + shaderFile;

    		MessageBox(NULL, strMsg.c_str(), "File load error", MB_OK );
    		*shaderID = 0;
    	}
    }
    */

    //-----------------------------------------------------------------------------
    // Name: getGlError()
    // Desc: Manage OpenGL errors
    //-----------------------------------------------------------------------------
    void CShader::getGlError(const string s, bool abort)
    {
    	GLenum glError = glGetError();
    	switch (glError ) {

    	case GL_NO_ERROR:  break;

    	case GL_INVALID_ENUM:  {
    		MessageBox(NULL, (s +
    			(const string) "An unacceptable value is specified for an enumerated argument.\n\nThe offending function is ignored, having no side effect other than to set the error flag.").c_str(),
    			"GL Error", MB_OK);
    						   } break;
    	case GL_INVALID_VALUE:  {
    		MessageBox(NULL, (s +
    			"A numeric argument is out of range.\n\nThe offending function is ignored, having no side effect other than to set the error flag.").c_str(),
    			"GL Error", MB_OK);
    						   } break;
    	case GL_INVALID_OPERATION:  {
        // Find the error position
        GLint errPos;
        glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB,&errPos );

    	string errPosStr;
    	const unsigned int BUFSIZE = 10;
    	char tmpBuf[BUFSIZE];
    	errPosStr = itoa(errPos, tmpBuf, BUFSIZE);

    	// Implementation-dependent errors
    	const string errString = (const char *) glGetString( GL_PROGRAM_ERROR_STRING_ARB);

    	const string str = s + (const string) "The specified operation is not allowed in the current state.\n\n" +
    				(const string)"The offending function is ignored, having no side effect other than to set the error flag.\n\n" +
    				(const string)"Error at position : " + errPosStr  + "\n\n" + errString;

    		MessageBox(NULL, str.c_str(), "GL Error", MB_OK);
    						   } break;
    	case GL_STACK_OVERFLOW:  {
    		MessageBox(NULL, (s +
    			"This function would cause a stack overflow.\n\nThe offending function is ignored, having no side effect other than to set the error flag.").c_str(),
    			"GL Error", MB_OK);
    						   } break;
    	case GL_STACK_UNDERFLOW:  {
    		MessageBox(NULL, (s +
    			"This function would cause a stack underflow.\n\nThe offending function is ignored, having no side effect other than to set the error flag.").c_str(),
    			"GL Error", MB_OK);
    						   } break;
    	case GL_OUT_OF_MEMORY:  {
    		MessageBox(NULL, (s +
    			"There is not enough memory left to execute the function.\n\nThe state of OpenGL is undefined, except for the state of the error flags, after this error is recorded.").c_str(),
    			"GL Error", MB_OK);
    						   } break;
    	default: 		{
    		MessageBox(NULL, (s + "Unknown OpenGL error").c_str(),
    			"GL Error", MB_OK);
    						   } break;
    	};

    	if (abort)
    	{
    	   // force abort on error
    	   assert( glError == GL_NO_ERROR );
    	};
    }

    //-----------------------------------------------------------------------------
    // Name: ~CShader()
    // Desc: Destructor
    //-----------------------------------------------------------------------------
    CShader::~CShader()
    {
    	for (unsigned int i = 0; i < nbrShaderFiles;i++ ) {
    		deleteShader(i);
    	}
    	delete [] vertexShaderFiles;
    	delete [] fragmentShaderFiles;
    	delete [] shaderNames;
    	delete [] vertexProgramID;
    	delete [] fragmentProgramID;

    	// Free up the lights
    	while (lightList.size()) {
    		//CLightDef *t = lightList[lightList.size()-1];
    		lightList.pop_back();
    		// TODO: Figure out how to free up this memory
    		//delete t;
    	}
    }

    ¡¡

    ¡¡

    ¡¡

    file name: main.h

    /****************************************************************************************/
    /* Function Manager class.
    /* DATED 28th Oct 2004
    							RAMGOPAL R		r_rajago@cs.concordia.ca
    /*                          LEVITT R		roanne.levitt@engenuitytech.com
    /* Updated 6-Dec-05
    /****************************************************************************************/
    #define __MAIN_H

    #include "windows.h"
    #include <vector>
    #include <time.h>
    #include <iostream>

    using namespace std;

    typedef void (* VoidFcnPtr)(void);

    // Class to hold an id/fcn pair
    class CFunctionCallback {
    	public:
    		CFunctionCallback(unsigned int iId, VoidFcnPtr iFn );
    		~CFunctionCallback();

    		unsigned int getId();
    		VoidFcnPtr getFcn();
    	private:
    		unsigned int id;
    		VoidFcnPtr fnPtr;
    };

    CFunctionCallback::CFunctionCallback(unsigned int iId, VoidFcnPtr iFn ) : fnPtr(iFn)
    {
    	id = iId;
    }

    CFunctionCallback::~CFunctionCallback()
    {
    }

    unsigned int CFunctionCallback::getId()
    {
    	return(id);
    };

    VoidFcnPtr CFunctionCallback::getFcn()
    {
    	return fnPtr;
    };

    // CFunctionCallbackMgr class
    //
    // This class keeps a list of mappings of IDs and their corresponding function pointers.
    class CFunctionCallbackMgr {
    public:
    	CFunctionCallbackMgr() {};
    	~CFunctionCallbackMgr();

    	// getFunction
    	//
    	// Return a pointer to the function that corresponds to the id provided
    	// Return NULL if not found
    	VoidFcnPtr getFunction(unsigned int id);

    	// addFunction
    	//
    	// Returns true if the new id-fcn mapping has been successfully added to the list
    	bool addFunction(unsigned int id, VoidFcnPtr fn );

    	// removeFunction
    	//
    	// Attempts to remove the function mapping as per id provided
    	// Returns true if successful
    	bool removeFunction(unsigned int id);

    private:
    	// List of all id-fcn mappings
    	vector<CFunctionCallback> fcnList;
    };
    CFunctionCallbackMgr::~CFunctionCallbackMgr()
    {
    	while (fcnList.size()) {
    		removeFunction( fcnList[0].getId() );
    	}
    }

    // getFunction
    //
    // Return a pointer to the function that corresponds to the id provided
    // Return NULL if not found
    VoidFcnPtr CFunctionCallbackMgr::getFunction(unsigned int id)
    {
    	unsigned int i;
    	for (i = 0; i < fcnList.size(); i++) {
    		if (fcnList[i].getId() == id) {
    			break;
    		}
    	}

    	assert(i < fcnList.size()); // ERROR!
    	return fcnList[i].getFcn();
    }

    // addFunction
    //
    // Returns true if the new id-fcn mapping has been successfully added to the list
    bool CFunctionCallbackMgr::addFunction(unsigned int id, VoidFcnPtr fn )
    {
    	// Allocate a new id-fcn class
    	CFunctionCallback *idfcn = new CFunctionCallback(id, fn);

    	// Add this to the list of mappings of id-function
    	if (idfcn) {
    		fcnList.push_back(*idfcn);
    		return true;
    	}

    	return false;
    };

    // removeFunction
    //
    // Attempts to remove the function mapping as per id provided
    // Returns true if successful
    bool CFunctionCallbackMgr::removeFunction(unsigned int id)
    {
    	// Find this id in the list
    	for (unsigned int i = 0; i < fcnList.size(); i++ ) {
    		// find this id in the list
    		if (fcnList[i].getId() == id) {
    			// remove item from list and free memory
    			CFunctionCallback &tmp = fcnList[i];
    			fcnList.erase(fcnList.begin( ) + i);
    			//delete tmp; // TODO: FIGURE OUT HOW TO GET PTR TO FREE UP MEMORY!!
    			return true;
    		}
    	}
    	return false;
    };

    ¡¡

    ¡¡

    file name: main.cpp (main)

    /****************************************************************************************/
    /*
    /* Main implementation file
    /* DATED 4th Oct 2004		RAMGOPAL R		r_rajago@cs.concordia.ca
    /*
    /* Acknowledgements - A part of the code is adapted from Clifford M. Bryant, Jr.
    /* Updated by Ramngopal R, 6-Dec-05
    /****************************************************************************************/

    #pragma warning(disable: 4786)

    #include "windows.h"
    #include <vector>
    #include <time.h>
    #include <iostream>
    #include "bitmap.h"
    #include "ply.h"
    #include "shader.h"
    #include "main.h"

    float coord_x=0, coord_y=0, coord_z=0;

    //
    // Global variables
    //
    bool useShader=true;
    CPly g_ply;
    vector<string> g_vecFilenames;
    int g_iModel = 0;
    string g_strPlyDir("ply\\");
    string g_strWindowTitle("Light me up!");
    unsigned int g_currentLight = 0;

    const char* textureFileName="lobbyxneg.bmp";

    // Function Mapper
    CFunctionCallbackMgr g_functionCallbackMgr;

    // Mouse interface
    int g_iLeftButtonDown = 0;
    int g_iShiftLeftButtonDown = 0;
    int g_iOldX, g_iOldY, g_iNewX, g_iNewY;

    // These values are changed in the motion() callback, and
    // they are then used to set up viewing and some modeling parameters.
    double g_dElevation = 0;
    double g_dAzimuth = 0;
    double g_dDist = 8;

    // Window dimensions
    int g_iww = 640, g_iwh = 480;

    // Whether Shaders are active or not.
    bool isShader = true;
    // Shader Class
    CShader g_shader;

    // Menu ids.
    int iMenu[2];

    GLfloat lightPosition[]={0.0,0.0,60.0};		//Point Light Position : down the positive axis
    GLfloat lightColor[]={1.0,1.0,1.0,1.0};		//Light color : White
    GLfloat matDiff[]={0.3,0.3,0.6,1.0};	//Model color : Blue
    GLfloat matSpec[]={0.5,0.5,1.0,1.0};	//Model color : Blue

    void intiLights(void){

    	glEnable(GL_LIGHTING);
    	glEnable(GL_LIGHT0);
    	glLightfv(GL_LIGHT0,GL_DIFFUSE,lightColor);
    	glLightfv(GL_LIGHT0,GL_SPECULAR,lightColor);
    	glLightfv(GL_LIGHT0,GL_POSITION,lightPosition);
    	glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,matDiff);
    	glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,matSpec);
    	glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,100.0);
    }

    string getWindowTitle()
    {
    	return g_strWindowTitle+"motion blur";
    	/*
    	if(isShader)
    		return (g_strWindowTitle + " - " +
    				g_vecFilenames[g_iModel] +
    				" (" + g_shader.getShaderName(g_shader.getShaderNdx()) +")" + ", Shaders Enabled"
    				);
    	return (g_strWindowTitle + " - " +
    			g_vecFilenames[g_iModel] +
    			" (" + g_shader.getShaderName(g_shader.getShaderNdx()) +")" + ", Shaders Disabled"
    			);
    			*/
    }

    void initTexture()
    {
    	GLubyte* bits;
    	BITMAPINFO* info;

    	bits=LoadDIBitmap(textureFileName, &info);
    	glTexImage2D(GL_TEXTURE_2D,0, 3, info->bmiHeader.biWidth, info->bmiHeader.biHeight,
    		0, GL_BGR_EXT, GL_UNSIGNED_BYTE, bits);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    	glEnable(GL_TEXTURE_2D);

    }

    void init()
    {
    	// Compile a list of the ply files.
    	WIN32_FIND_DATA ffd;
    	HANDLE h = ::FindFirstFile((g_strPlyDir + "*.ply").c_str(), &ffd);
    	g_vecFilenames.push_back(string(ffd.cFileName));
    	while (::FindNextFile(h, &ffd))
    		g_vecFilenames.push_back(string(ffd.cFileName));
    	::FindClose(h);

    	// Read in the first model.
    	g_ply.read((g_strPlyDir + g_vecFilenames[g_iModel]).c_str());
    	glutSetWindowTitle(getWindowTitle().c_str());

    	// Calculate the averaged normals at the vertices.
    	g_ply.calcNormals();

    	// Set the initial window height.
    	g_iwh = g_iww / CVertex::getAspect();
    	g_dDist = -CVertex::getDist();

        // Enable depth test
        glEnable(GL_DEPTH_TEST);
    	glShadeModel(GL_SMOOTH);

    /*
     * initialize shader.
     */
    	g_shader.initShader();
    	intiLights();
    	initTexture();
    }

    void display (void)
    {
    	static bool firstTime=true;
    	static int ticking=0;
    	float temp[16];

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    	ticking++;
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

        // Set the camera coordinates.
        gluLookAt(0, 0, g_dDist,
                  0, 0, 0,
                  0, 1, 0);

    	// Translate the model down the negative z-axis.
    	glTranslated(coord_x, coord_y, CVertex::getDist());

    	// Perform the model rotations according to the mouse movements.
        //glRotatef(g_dElevation, 1, 0, 0);
        //glRotatef(g_dAzimuth, 0, 1, 0);

    	// Center the model at the origin.
    	//CVertex::centerModel();
    	if (useShader)
    	{
    		if (strcmp((g_shader.getShaderName(g_shader.currentShader)).c_str(), "MotionBlur")==0)
    		{
    			if (firstTime)
    			{
    				firstTime=false;
    			}
    			else
    			{
    				if (ticking%10==0)
    				{
    					glGetFloatv(GL_MODELVIEW_MATRIX, temp);
    					glUniformMatrix4fvARB(g_shader.preMatrixLocation, 1, GL_FALSE, g_shader.preMatrix);

    					getLastError();
    				}
    			}
    		}
    		else
    		{
    			firstTime=true;
    		}

    		if (strcmp((g_shader.getShaderName(g_shader.currentShader)).c_str(), "ripple")==0)
    		{
    			getLastError();
    			//ticking=(ticking+1)%20;

    			glUniform1fARB(g_shader.tickingLocation, (float)ticking);
    			getLastError();
    		}
    	}

    	g_ply.draw();

    	getLastError();

    	glGetFloatv(GL_MODELVIEW_MATRIX, g_shader.preMatrix);

        glutSwapBuffers();
    }

    void resize (int w, int h)
    {
        g_iww = w;
        g_iwh = h;

        // Prevent a divide by zero
        if (h == 0) h = 1;

        // Set Viewport to window dimensions
        glViewport(0, 0, w, h);

        // Set viewing frustum
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluPerspective(CVertex::getFovy(), static_cast<double>(w) / h,
    		CVertex::getNear(), CVertex::getFar());
    }

    void mouse (int button, int state, int x, int y)
    {
        g_iNewX = x;
        g_iNewY = y;

        // Left mouse button pressed
        if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
        {
            g_iLeftButtonDown = 1;
            g_iShiftLeftButtonDown = (glutGetModifiers() == GLUT_ACTIVE_SHIFT);
        }
        else
        {
            g_iShiftLeftButtonDown = g_iLeftButtonDown = 0;
        }
    }

    void motion (int x, int y)
    {
        double dRelX, dRelY;

        g_iOldX = g_iNewX;
        g_iOldY = g_iNewY;
        g_iNewX = x;
        g_iNewY = y;

        if (g_iShiftLeftButtonDown)
        {
            // Change distance
    		dRelY = (g_iNewY - g_iOldY);
            //g_dDist += (dRelY * CVertex::getDepth() / 10);

        }
    	else if (g_iLeftButtonDown)
        {

    		// Change Rotation
    	    dRelX = (g_iNewX - g_iOldX);
    		coord_x += dRelX/4.0;
    		//coord_x = x;
    		dRelY = (g_iNewY - g_iOldY);
    		coord_y += dRelY/4.0;
    		//coord_y= y;

            g_dAzimuth += dRelX;
            g_dElevation += dRelY;
        }

        glutPostRedisplay();
    }

    void special (int key, int x, int y)
    {
    	switch (key)
    	{
    	case GLUT_KEY_LEFT:
    		g_iModel++;
    		if ((unsigned int)g_iModel >= g_vecFilenames.size()) g_iModel = 0;

    		// Read in the next model.
    		g_ply.read((g_strPlyDir + g_vecFilenames[g_iModel]).c_str());
    		glutSetWindowTitle(getWindowTitle().c_str());

    		// Calculate the averaged normals at the vertices.
    		g_ply.calcNormals();

    		// Set the initial window height.
    		g_iwh = g_iww / CVertex::getAspect();
    		g_dDist = CVertex::getDepth();

    		glutReshapeWindow(g_iww, g_iwh);
    		break;

      // Previous Model.
    	case GLUT_KEY_RIGHT:
    		g_iModel--;
    		if (g_iModel < 0) g_iModel = g_vecFilenames.size() - 1;

    		// Read in the first model.
    		g_ply.read((g_strPlyDir + g_vecFilenames[g_iModel]).c_str());
    		glutSetWindowTitle(getWindowTitle().c_str());

    		// Calculate the averaged normals at the vertices.
    		g_ply.calcNormals();

    		// Set the initial window height.
    		g_iwh = g_iww / CVertex::getAspect();
    		g_dDist = CVertex::getDepth();

    		glutReshapeWindow(g_iww, g_iwh);
    		break;
    	}
    	glutPostRedisplay();
    }

    void keyboard (unsigned char c, int x, int y)
    {
        switch (c)
        {
        case 27:
        case 'q':
            exit(0);
            break;

        }
    }

    void reloadAllShaders(){
    	g_shader.reLoadAllShaders();
    	glutPostRedisplay();
    }

    void enableShaders(){
    	isShader = !isShader;
    	if(isShader)
    		glutSetMenu(iMenu[0]);
    	else
    		glutSetMenu(iMenu[1]);

    	glutAttachMenu(GLUT_RIGHT_BUTTON);
    	glutPostRedisplay();
    }

    void wireFrame(){
    	glPolygonMode(GL_FRONT, GL_LINE);
    	glutPostRedisplay();
    }

    void fill(){
    	glPolygonMode(GL_FRONT, GL_FILL);
    	glutPostRedisplay();
    }

    void menuCallback(int iChoice)
    {
    /*
     * Select the shader to apply.
     */
    	if ((unsigned int) iChoice < g_shader.getNbrShaders() )
    	{
    	   g_shader.selectShader(iChoice);
    	} else {
    		// Find the function from the fuction mapper
    		VoidFcnPtr fcnPtr = g_functionCallbackMgr.getFunction(iChoice);

    		// Call the function found
    		(*fcnPtr)();
    	}
       glutSetWindowTitle(getWindowTitle().c_str());
    }

    void create_menus()
    {
        // Create the main menu.
        iMenu[0] = glutCreateMenu (menuCallback);
    	unsigned int i = 0;
    	for ( ; i < g_shader.getNbrShaders(); i++) {
    	    glutAddMenuEntry(g_shader.getShaderName(i).c_str(), i);
    	}

    	// Add a few more menu items of interest

    	// Add the Reload Shaders menu item
    	glutAddMenuEntry("Reload shaders", i); // Add the menu entry
    	g_functionCallbackMgr.addFunction( i++, reloadAllShaders); // Add the function callback

    	// Add the Wire
    	glutAddMenuEntry("Wireframe", i); // Add the menu entry
    	g_functionCallbackMgr.addFunction( i++, wireFrame); // Add the function callback

    	// Add the Wire
    	glutAddMenuEntry("Solid", i); // Add the menu entry
    	g_functionCallbackMgr.addFunction( i++, fill); // Add the function callback

    	// Enable/Disable Shaders option
    	glutAddMenuEntry("Disable Shaders", i); // Add the menu entry
    	g_functionCallbackMgr.addFunction( i++, enableShaders); // Add the function callback

    	// Attach the menu to the right mouse button
        glutAttachMenu(GLUT_RIGHT_BUTTON);

    	iMenu[1] = glutCreateMenu (menuCallback);

    	// Enable/Disable Shaders option
    	glutAddMenuEntry("Enable Shaders", i); // Add the menu entry
    	g_functionCallbackMgr.addFunction( i++, enableShaders); // Add the function callback

    }

    int main(int argc, char* argv[])
    {
        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
        glutInitWindowSize(g_iww, g_iwh);
        glutInitWindowPosition(180, 100);
        glutCreateWindow(g_strWindowTitle.c_str());

        glutDisplayFunc(display);
        glutReshapeFunc(resize);
        glutMouseFunc(mouse);
        glutMotionFunc(motion);
        glutKeyboardFunc(keyboard);
    	glutSpecialFunc(special);

    	SetupARBExtensions();
    	SetupGLSLExtensions();
        init();

    	create_menus();

        glutMainLoop();
        return 0;
    }

    ¡¡

    ¡¡

    file name: motionblur.vert (vertex shader)

    const float SpecularContribution=0.16;
    uniform vec4 LightPosition;
    uniform mat4 preMatrix;
    varying vec4 MCPosition;

    varying float blur;

    varying float LightIntensity;
    void main(void)
    {
    	vec4 prePos, curPos, velocity;
    	vec4 myLightPos=gl_LightSource[0].position;
    	//float blur;
        float diffusecontribution  = 1.0 - SpecularContribution;

        // compute the vertex position in eye coordinates

    	curPos = gl_ModelViewMatrix * gl_Vertex;
        prePos = preMatrix* gl_Vertex;

    	velocity=curPos - prePos;

    	vec3  tnorm   = normalize(gl_NormalMatrix * gl_Normal);

    	blur= dot(tnorm, velocity.xyz);

    	if (blur>=0.0)
    	{
    		MCPosition=curPos;
    		//MCPosition=prePos;
    	}
    	else
    	{
    		//MCPosition=curPos;
    		MCPosition=prePos;
    	}

        // compute the transformed normal

        // compute a vector from the model to the light position
        //vec4  lightVec             = normalize(LightPosition - MCPosition);
    	vec4  lightVec  = normalize(myLightPos - MCPosition);

        // compute the reflection vector
        vec4  reflectVec           = vec4(reflect(-lightVec.xyz, tnorm), 1.0);

        // compute a unit vector in direction of viewing position
        vec4  viewVec       = normalize(-MCPosition);

        // calculate amount of diffuse light based on normal and light angle
        float diffuse              = max(dot(lightVec.xyz, tnorm), 0.0);
        float spec                 = 0.0;

        // if there is diffuse lighting, calculate specular
        if(diffuse > 0.0)
    	   {
    		  spec = max(dot(reflectVec, viewVec), 0.0);
    		  spec = pow(spec, 16.0);
    	   }
        // add up the light sources, since this is a varying (global) it will pass to frag shader
        LightIntensity  = diffusecontribution * diffuse  +  SpecularContribution * spec;

        // the varying variable MCPosition will be used by the fragment shader to determine where
       // in model space the current pixel is
        //MCPosition      = gl_Vertex;
        // send vertex information

        gl_Position     = gl_ProjectionMatrix * MCPosition;
    }

    ¡¡

    file name: motionblur.frag (fragment shader)

    //
    // Fragment shader for 3 dimensional polka dot shader.
    //
    // Author:  Joshua Doss
    //
    // Copyright (C) 2002-2006  3Dlabs Inc. Ltd.
    //
    // See 3Dlabs-License.txt for license information
    //

    varying float LightIntensity;
    varying vec4 MCPosition;
    varying float blur;

    const float DotSize=0.13;

    //Create uniform variables so dots can be spaced and scaled by user
    const vec4 Spacing=vec4(0.3,0.3,0.25, 1.0);

    //Create colors as uniform variables so they can be easily changed
    const vec4 ModelColor=vec4(0.8, 0.3, 0.0, 1.0), LightColor=vec4(0.8, 0.8, 0.8, 1.0);

    const vec4 noiseColor=vec4(0.2, 0.3, 0.1, 1.0);

    void main(void)
    {

       float insidesphere, sphereradius, scaledpointlength;
       vec4 scaledpoint, finalcolor;

       // Scale the coordinate system
       // The following line of code is not yet implemented in current drivers:
       // mcpos = mod(Spacing, MCposition);
       // We will use a workaround found below for now
       //scaledpoint       = MCPosition - (Spacing * floor(MCPosition/Spacing));

       // Bring the scaledpoint vector into the center of the scaled coordinate system
       //scaledpoint       = scaledpoint - Spacing/2.0;

       // Find the length of the scaledpoint vector and compare it to the dotsize
       //scaledpointlength = length(scaledpoint);
       //insidesphere      = step(scaledpointlength,DotSize);

       // Determine final output color before lighting

       //finalcolor        = vec4(mix(ModelColor, LightColor, insidesphere));

       // Output final color and factor in lighting

       //gl_FragColor      = clamp(finalcolor * LightIntensity, 0.0, 1.0);

       finalcolor        = vec4(mix(ModelColor, LightColor, LightIntensity));

       finalcolor=mix(finalcolor, noiseColor, blur);

       gl_FragColor = normalize(finalcolor);

    }

    ¡¡

    ¡¡

    file name: ripple.vert (vertex shader)

    const float SpecularContribution=0.16;
    //const float Center_x=200.0, Center_y=200.0;
    const float Pi=3.14;
    const float Frequency=15.0;
    const float WaveLength=2.6;
    const float AngleSpeed=8.0*Pi/WaveLength;
    const float PhaseSpeed=Frequency*AngleSpeed;
    const float Amplitude=5.0;

    //const float Radius=20.0;

    const vec2 Center=vec2(0.0, 0.0);

    varying vec4 position;
    varying float spec;

    uniform float ticking;

    void main(void)
    {

    	position=gl_ModelViewMatrix*gl_Vertex;
    	vec2 radius=position.xy-Center;

    	vec3 normal;

    	vec4 viewVec, lightVec, halfVec;

    	float angle;

    	float diffuse=1.0-SpecularContribution;

    	angle= length(radius)*AngleSpeed+PhaseSpeed*ticking;
    	position.z=position.z + Amplitude*sin(angle);

    	lightVec=normalize(gl_LightSource[0].position - position);

    	viewVec=normalize(-position);

    	halfVec=normalize(lightVec+viewVec);

    /*
    	normal.x=AngleSpeed*position.x*Amplitude*cos(angle);

    	normal.y=AngleSpeed*position.y*Amplitude*cos(angle);
    	normal.z=1.0;
    	normal=normalize(normal);
    	*/

    	normal=gl_NormalMatrix*gl_Normal;

    	spec=dot(halfVec.xyz, normal);

        gl_Position     = gl_ProjectionMatrix * position;
    }

    ¡¡

    ¡¡

    file name: ripple.frag (fragment shader)

    const float LightIntensity=0.16;

    varying float spec;

    varying vec4 position;

    uniform float ticking;

    const vec4 ModelColor=vec4(0.8, 0.3, 0.0, 1.0), LightColor=vec4(0.8, 0.8, 0.8, 1.0);

    void main(void)
    {
    	if (mod(gl_FragCoord.x, 2.0)==0.0 && mod(gl_FragCoord.y, 2.0)==0.0)
    	{
    		gl_FragColor=vec4(1.0, 1.0, 1.0, 1.0);
    	}
    	else
    	{
    		gl_FragColor=mix(ModelColor, LightColor, spec);
    	}

    }

    ¡¡

    ¡¡

    ¡¡

    ¡¡

    ¡¡