00001 #include "GLEXTHandler.h" 00002 00003 #ifdef _WIN32 00004 #include <windows.h> 00005 #endif 00006 00007 #if defined(__APPLE__) || defined(MACOSX) 00008 #include <GLUT/glut.h> 00009 #else 00010 #include <GL/glut.h> 00011 #endif 00012 00013 PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; 00014 PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB; 00015 PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; 00016 PFNGLDETACHOBJECTARBPROC glDetachObjectARB; 00017 PFNGLGENPROGRAMSARBPROC glGenProgramsARB; 00018 PFNGLBINDPROGRAMARBPROC glBindProgramARB; 00019 PFNGLPROGRAMSTRINGARBPROC glProgramStringARB; 00020 PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; 00021 PFNGLSHADERSOURCEARBPROC glShaderSourceARB; 00022 PFNGLCOMPILESHADERARBPROC glCompileShaderARB; 00023 PFNGLGETINFOLOGARBPROC glGetInfoLogARB; 00024 PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; 00025 PFNGLATTACHOBJECTARBPROC glAttachObjectARB; 00026 PFNGLLINKPROGRAMARBPROC glLinkProgramARB; 00027 PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; 00028 PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; 00029 PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; 00030 PFNGLUNIFORM1IARBPROC glUniform1iARB; 00031 PFNGLUNIFORM1FARBPROC glUniform1fARB; 00032 PFNGLACTIVETEXTUREARBPROC glActiveTextureARB; 00033 PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT; 00034 PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT; 00035 PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; 00036 PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; 00037 PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; 00038 PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT; 00039 PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT; 00040 PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; 00041 PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB; 00042 PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; 00043 PFNGLBINDBUFFERARBPROC glBindBufferARB; 00044 PFNGLGENBUFFERSARBPROC glGenBuffersARB; 00045 PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB; 00046 PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB; 00047 PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB; 00048 PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT; 00049 PFNGLBUFFERDATAARBPROC glBufferDataARB; 00050 PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; 00051 PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT; 00052 00053 void SetupAllExtensions() 00054 { 00055 //Simply go through and set all of the extension instantiation in this program. 00056 glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)wglGetProcAddress("glGetObjectParameterivARB"); 00057 glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC)wglGetProcAddress( "glGetAttachedObjectsARB" ); 00058 glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)wglGetProcAddress("glDeleteObjectARB" ); 00059 glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC)wglGetProcAddress("glDetachObjectARB" ); 00060 glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)wglGetProcAddress( "glGenProgramsARB" ); 00061 glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)wglGetProcAddress( "glBindProgramARB" ); 00062 glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)wglGetProcAddress( "glProgramStringARB" ); 00063 glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)wglGetProcAddress( "glCreateShaderObjectARB" ); 00064 glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)wglGetProcAddress( "glShaderSourceARB" ); 00065 glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)wglGetProcAddress( "glCompileShaderARB" ); 00066 glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)wglGetProcAddress( "glGetInfoLogARB" ); 00067 glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)wglGetProcAddress( "glCreateProgramObjectARB" ); 00068 glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)wglGetProcAddress( "glAttachObjectARB" ); 00069 glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)wglGetProcAddress( "glLinkProgramARB" ); 00070 glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)wglGetProcAddress( "glProgramEnvParameter4fARB" ); 00071 glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)wglGetProcAddress( "glUseProgramObjectARB" ); 00072 glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress( "glGetUniformLocationARB" ); 00073 glUniform1iARB = (PFNGLUNIFORM1IARBPROC)wglGetProcAddress( "glUniform1iARB" ); 00074 glUniform1fARB = (PFNGLUNIFORM1FARBPROC)wglGetProcAddress( "glUniform1fARB" ); 00075 glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress( "glActiveTextureARB" ); 00076 glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)wglGetProcAddress( "glDeleteRenderbuffersEXT" ); 00077 glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress( "glGenRenderbuffersEXT" ); 00078 glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)wglGetProcAddress( "glBindFramebufferEXT" ); 00079 glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress( "glDeleteFramebuffersEXT" ); 00080 glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)wglGetProcAddress( "glGenFramebuffersEXT" ); 00081 glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)wglGetProcAddress( "glBindRenderbufferEXT" ); 00082 glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress( "glRenderbufferStorageEXT" ); 00083 glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)wglGetProcAddress( "glFramebufferTexture2DEXT" ); 00084 glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)wglGetProcAddress( "glDrawBuffersARB" ); 00085 glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)wglGetProcAddress( "glDeleteBuffersARB" ); 00086 glBindBufferARB = (PFNGLBINDBUFFERARBPROC)wglGetProcAddress( "glBindBufferARB" ); 00087 glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)wglGetProcAddress( "glGenBuffersARB" ); 00088 glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)wglGetProcAddress( "glGetAttribLocationARB" ); 00089 glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)wglGetProcAddress( "glEnableVertexAttribArrayARB" ); 00090 glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)wglGetProcAddress( "glVertexAttribPointerARB" ); 00091 glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress( "glFramebufferRenderbufferEXT" ); 00092 glBufferDataARB = (PFNGLBUFFERDATAARBPROC)wglGetProcAddress( "glBufferDataARB" ); 00093 glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)wglGetProcAddress( "glCheckFramebufferStatusEXT" ); 00094 glProgramParameteriEXT = (PFNGLPROGRAMPARAMETERIEXTPROC)wglGetProcAddress( "glProgramParameteriEXT" ); 00095 } 00096 00097 //Public domain 2007 Charles Lohr 00098 //OpenGL Code copyright OpenGL