better glext.h file

Ok i admit it, i’m new to OpenGL programming, but i have seen that it is easier to use OpenGL extentions on nix’s then it is on windows.

i made a small change to my glext.h file, that seems to allow me to compile most nix OpenGL demo’s with very few changes to the source. (mostly changes not even relating to OpenGL)

this is what i did in a nutshell:

#ifdef GL_GLEXT_PROTOTYPES

ifdef WIN32

define GLEXT(type,command,name,args) typedef type (APIENTRY * command) args;command name = NULL

else

define GLEXT(type,command,name,args) GLAPI type APIENTRY name args;typedef type (APIENTRY * command) args

endif

#else

define GLEXT(type,command,name,args) typedef type (APIENTRY * command) args

#endif

#ifndef GL_VERSION_1_2
#define GL_VERSION_1_2 1
GLEXT(void, PFNGLBLENDCOLORPROC, glBlendColor,(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha));
GLEXT(void, PFNGLBLENDEQUATIONPROC, glBlendEquation,(GLenum mode));
GLEXT(void, PFNGLDRAWRANGEELEMENTSPROC, glDrawRangeElements,(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices));
GLEXT(void, PFNGLCOLORTABLEPROC, glColorTable,(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table));
GLEXT(void, PFNGLCOLORTABLEPARAMETERFVPROC, glColorTableParameterfv,(GLenum target, GLenum pname, const GLfloat *params));
GLEXT(void, PFNGLCOLORTABLEPARAMETERIVPROC, glColorTableParameteriv,(GLenum target, GLenum pname, const GLint *params));
GLEXT(void, PFNGLCOPYCOLORTABLEPROC, glCopyColorTable,(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width));
GLEXT(void, PFNGLGETCOLORTABLEPROC, glGetColorTable,(GLenum target, GLenum format, GLenum type, GLvoid *table));
GLEXT(void, PFNGLGETCOLORTABLEPARAMETERFVPROC, glGetColorTableParameterfv,(GLenum target, GLenum pname, GLfloat *params));
GLEXT(void, PFNGLGETCOLORTABLEPARAMETERIVPROC, glGetColorTableParameteriv,(GLenum target, GLenum pname, GLint *params));
GLEXT(void, PFNGLCOLORSUBTABLEPROC, glColorSubTable,(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data));
GLEXT(void, PFNGLCOPYCOLORSUBTABLEPROC, glCopyColorSubTable,(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width));
GLEXT(void, PFNGLCONVOLUTIONFILTER1DPROC, glConvolutionFilter1D,(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image));
GLEXT(void, PFNGLCONVOLUTIONFILTER2DPROC, glConvolutionFilter2D,(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image));
GLEXT(void, PFNGLCONVOLUTIONPARAMETERFPROC, glConvolutionParameterf,(GLenum target, GLenum pname, GLfloat params));
GLEXT(void, PFNGLCONVOLUTIONPARAMETERFVPROC, glConvolutionParameterfv,(GLenum target, GLenum pname, const GLfloat *params));
GLEXT(void, PFNGLCONVOLUTIONPARAMETERIPROC, glConvolutionParameteri,(GLenum target, GLenum pname, GLint params));

etc… you see the idea
if this were to put made part of the official glext.h i think it would make it much easier for new OpenGL developers, as well as simplifying porting cross platform.

This change is not supported by all compilers as it is not valid C – though it is valid modern C. Some existing important targets will cease to function if this change is made. (And it’s also likely that it will break Longhorn too.)