00001 00007 #include "OpenGLext.h" 00008 00009 00010 // WGL_ARB_extensions_string 00011 bool WGL_ARB_extensions_string_supported = false; 00012 00013 WGL_ARB_EXTENSIONS_STRING wglGetExtensionsStringARB = NULL; 00014 00015 00016 // WGL_ARB_pixel_format 00017 bool WGL_ARB_pixel_format_supported = false; 00018 00019 PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB = NULL; 00020 PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGetPixelFormatAttribfvARB = NULL; 00021 PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = NULL; 00022 00023 00024 // GL_EXT_blend 00025 bool GL_EXT_blend_color_supported = false; 00026 bool GL_EXT_blend_func_separate_supported = false; 00027 bool GL_EXT_blend_minmax_supported = false; 00028 bool GL_EXT_blend_subtract_supported = false; 00029 00030 PFNGLBLENDCOLOREXTPROC glBlendColorEXT = NULL; 00031 PFNGLBLENDFUNCSEPARATEEXTPROC glBlendFuncSeparateEXT = NULL; 00032 PFNGLBLENDEQUATIONEXTPROC glBlendEquationEXT = NULL; 00033 00034 00035 // GL_ARB_multitexture 00036 bool GL_ARB_multitexture_supported = false; 00037 00038 PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL; 00039 PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = NULL; 00040 00041 PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB = NULL; 00042 PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB = NULL; 00043 00044 PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = NULL; 00045 PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB = NULL; 00046 00047 PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB = NULL; 00048 PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB = NULL; 00049 00050 PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB = NULL; 00051 PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB = NULL; 00052 00053 00054 // GL_ARB_point_parameters 00055 bool GL_ARB_point_parameters_supported; 00056 00057 PFNGLPOINTPARAMETERFARBPROC glPointParameterfARB = NULL; 00058 PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB = NULL; 00059 00060 00061 // GL_ARB_vertex_buffer_object 00062 bool GL_ARB_vertex_buffer_object_supported = false; 00063 00064 PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL; 00065 PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = NULL; 00066 PFNGLGENBUFFERSARBPROC glGenBuffersARB = NULL; 00067 PFNGLISBUFFERARBPROC glIsBufferARB = NULL; 00068 00069 PFNGLBUFFERDATAARBPROC glBufferDataARB = NULL; 00070 PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB = NULL; 00071 PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB = NULL; 00072 00073 PFNGLMAPBUFFERARBPROC glMapBufferARB = NULL; 00074 PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = NULL; 00075 00076 PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = NULL; 00077 PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = NULL; 00078 00079 00080 // GL_ARB_vertex_program 00081 bool GL_ARB_vertex_program_supported = false; 00082 00083 PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB = NULL; 00084 PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = NULL; 00085 PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = NULL; 00086 PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB = NULL; 00087 PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB = NULL; 00088 PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB = NULL; 00089 PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = NULL; 00090 PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = NULL; 00091 PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB = NULL; 00092 PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB = NULL; 00093 PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB = NULL; 00094 PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = NULL; 00095 PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB = NULL; 00096 PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB = NULL; 00097 PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB = NULL; 00098 PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = NULL; 00099 PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB = NULL; 00100 PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB = NULL; 00101 PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB = NULL; 00102 PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = NULL; 00103 PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = NULL; 00104 PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB = NULL; 00105 PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = NULL; 00106 PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB = NULL; 00107 PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB = NULL; 00108 PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB = NULL; 00109 PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB = NULL; 00110 PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB = NULL; 00111 PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB = NULL; 00112 PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = NULL; 00113 PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB = NULL; 00114 PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB = NULL; 00115 PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB = NULL; 00116 PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB = NULL; 00117 PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB = NULL; 00118 PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB = NULL; 00119 PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB = NULL; 00120 PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB = NULL; 00121 PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB = NULL; 00122 PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL; 00123 PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL; 00124 PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = NULL; 00125 PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL; 00126 PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB = NULL; 00127 PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB = NULL; 00128 PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL; 00129 PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB = NULL; 00130 PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB = NULL; 00131 PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB = NULL; 00132 PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB = NULL; 00133 PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB = NULL; 00134 PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB = NULL; 00135 PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB = NULL; 00136 PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB = NULL; 00137 PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB = NULL; 00138 PFNGLGETPROGRAMIVARBPROC glGetProgramivARB = NULL; 00139 PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB = NULL; 00140 PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB = NULL; 00141 PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = NULL; 00142 PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = NULL; 00143 PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = NULL; 00144 PFNGLISPROGRAMARBPROC glIsProgramARB = NULL; 00145 00146 00147 // GL_ARB_shader_objects 00148 bool GL_ARB_shader_objects_supported = false; 00149 00150 PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL; 00151 PFNGLGETHANDLEARBPROC glGetHandleARB = NULL; 00152 PFNGLDETACHOBJECTARBPROC glDetachObjectARB = NULL; 00153 PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL; 00154 PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL; 00155 PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL; 00156 PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL; 00157 PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL; 00158 PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL; 00159 PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL; 00160 PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB = NULL; 00161 00162 PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL; 00163 PFNGLUNIFORM2FARBPROC glUniform2fARB = NULL; 00164 PFNGLUNIFORM3FARBPROC glUniform3fARB = NULL; 00165 PFNGLUNIFORM4FARBPROC glUniform4fARB = NULL; 00166 00167 PFNGLUNIFORM1IARBPROC glUniform1iARB = NULL; 00168 PFNGLUNIFORM2IARBPROC glUniform2iARB = NULL; 00169 PFNGLUNIFORM3IARBPROC glUniform3iARB = NULL; 00170 PFNGLUNIFORM4IARBPROC glUniform4iARB = NULL; 00171 00172 PFNGLUNIFORM1FVARBPROC glUniform1fvARB = NULL; 00173 PFNGLUNIFORM2FVARBPROC glUniform2fvARB = NULL; 00174 PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL; 00175 PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL; 00176 00177 PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL; 00178 PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL; 00179 PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL; 00180 PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL; 00181 00182 PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB = NULL; 00183 PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB = NULL; 00184 PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB = NULL; 00185 00186 PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB = NULL; 00187 PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = NULL; 00188 PFNGLGETINFOLOGARBPROC glGetInfoLogARB = NULL; 00189 PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB = NULL; 00190 PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL; 00191 PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = NULL; 00192 PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = NULL; 00193 PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = NULL; 00194 PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = NULL; 00195 00196 00197 // GL_ARB_shading_language_100 00198 bool GL_ARB_shading_language_100_supported = false; 00199 00200 00201 // GL_ARB_vertex_shader 00202 bool GL_ARB_vertex_shader_supported = false; 00203 00204 PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = NULL; 00205 PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL; 00206 PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL; 00207 00208 00209 // GL_ARB_fragment_program 00210 bool GL_ARB_fragment_program_supported = false; 00211 00212 00213 // GL_ARB_fragment_shader 00214 bool GL_ARB_fragment_shader_supported = false; 00215 00216 00217 // GL_ARB_occlusion_query 00218 bool GL_ARB_occlusion_query_supported = false; 00219 00220 PFNGLGENQUERIESARBPROC glGenQueriesARB = NULL; 00221 PFNGLDELETEQUERIESARBPROC glDeleteQueriesARB = NULL; 00222 PFNGLISQUERYARBPROC glIsQueryARB = NULL; 00223 PFNGLBEGINQUERYARBPROC glBeginQueryARB = NULL; 00224 PFNGLENDQUERYARBPROC glEndQueryARB = NULL; 00225 PFNGLGETQUERYIVARBPROC glGetQueryivARB = NULL; 00226 PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB = NULL; 00227 PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB = NULL; 00228 00229 00230 // GL_NV_occlusion_query 00231 bool GL_NV_occlusion_query_supported = false; 00232 00233 PFNGLGENOCCLUSIONQUERIESNVPROC glGenOcclusionQueriesNV = NULL; 00234 PFNGLDELETEOCCLUSIONQUERIESNVPROC glDeleteOcclusionQueriesNV = NULL; 00235 PFNGLISOCCLUSIONQUERYNVPROC glIsOcclusionQueryNV = NULL; 00236 PFNGLBEGINOCCLUSIONQUERYNVPROC glBeginOcclusionQueryNV = NULL; 00237 PFNGLENDOCCLUSIONQUERYNVPROC glEndOcclusionQueryNV = NULL; 00238 PFNGLGETOCCLUSIONQUERYIVNVPROC glGetOcclusionQueryivNV = NULL; 00239 PFNGLGETOCCLUSIONQUERYUIVNVPROC glGetOcclusionQueryuivNV = NULL; 00240 00241 00242 /******************************************************************** 00243 * In Str 00244 */ 00245 bool inStr(char *str, char *searchStr) { 00246 if (strstr(str, searchStr)) 00247 return true; 00248 return false; 00249 } 00250 00251 bool findExtension(char *extensions, char *extension){ 00252 if (extensions){ 00253 char *str = extensions; 00254 int len = strlen(extension); 00255 00256 while ((str = strstr(str, extension)) != NULL){ 00257 str += len; 00258 if (*str == ' ' || *str == '\0') return true; 00259 } 00260 } 00261 return false; 00262 } 00263 00264 /******************************************************************** 00265 * Init Extensions 00266 */ 00267 bool initExtensions(HDC hDC) { 00268 // LOG_NEWLINE; 00269 00270 char *extensions = NULL; 00271 char *wglxExtensions = NULL; 00272 00273 00274 extensions = (char *)glGetString(GL_EXTENSIONS); 00275 00276 if (extensions == NULL) { 00277 LOG_ERROR(("GL_EXTENSIONS not supported")); 00278 //return false; 00279 } 00280 else { 00281 LOG_SUCCESS(("GL_EXTENSIONS supported!")); 00282 } 00283 00284 00285 if (((wglGetExtensionsStringARB = (WGL_ARB_EXTENSIONS_STRING) wglGetProcAddress("wglGetExtensionsStringARB")) != NULL) || 00286 ((wglGetExtensionsStringARB = (WGL_ARB_EXTENSIONS_STRING) wglGetProcAddress("wglGetExtensionsStringEXT")) != NULL)){ 00287 WGL_ARB_extensions_string_supported = true; 00288 wglxExtensions = wglGetExtensionsStringARB(hDC); 00289 LOG_SUCCESS(("WGL_ARB_extensions_string supported!")); 00290 } 00291 else { 00292 LOG_ERROR(("WGL_ARB_extensions_string not supported")); 00293 } 00294 00295 00296 // GL_EXT_blend 00297 if (GL_EXT_blend_color_supported = isExtensionSupported("GL_EXT_blend_color")){ 00298 glBlendColorEXT = (PFNGLBLENDCOLOREXTPROC)wglGetProcAddress("glBlendColorEXT"); 00299 LOG_SUCCESS(("GL_EXT_blend_color supported!")); 00300 } 00301 else 00302 LOG_ERROR(("GL_EXT_blend_color not supported")); 00303 00304 if (GL_EXT_blend_func_separate_supported = isExtensionSupported("GL_EXT_blend_func_separate")){ 00305 glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)wglGetProcAddress("glBlendFuncSeparateEXT"); 00306 LOG_SUCCESS(("GL_EXT_blend_func_separate not supported")); 00307 } 00308 else 00309 LOG_ERROR(("GL_EXT_blend_func_separate not supported")); 00310 00311 GL_EXT_blend_minmax_supported = isExtensionSupported("GL_EXT_blend_minmax"); 00312 GL_EXT_blend_subtract_supported = isExtensionSupported("GL_EXT_blend_subtract"); 00313 if (GL_EXT_blend_minmax_supported || GL_EXT_blend_subtract_supported){ 00314 glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)wglGetProcAddress("glBlendEquationEXT"); 00315 } 00316 00317 if (GL_EXT_blend_minmax_supported) 00318 LOG_SUCCESS(("GL_EXT_blendminmax supported!")); 00319 else 00320 LOG_ERROR(("GL_EXT_blendminmax not supported")); 00321 00322 if (GL_EXT_blend_subtract_supported) 00323 LOG_SUCCESS(("GL_EXT_blend_subtract supported!")); 00324 else 00325 LOG_ERROR(("GL_EXT_blend_subtract not supported")); 00326 00327 00328 // ARB_multitexture 00329 if (GL_ARB_multitexture_supported = isExtensionSupported("GL_ARB_multitexture")) { 00330 glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB"); 00331 glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)wglGetProcAddress("glClientActiveTextureARB"); 00332 00333 glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)wglGetProcAddress("glMultiTexCoord1fARB"); 00334 glMultiTexCoord1fvARB = (PFNGLMULTITEXCOORD1FVARBPROC)wglGetProcAddress("glMultiTexCoord1fvARB"); 00335 00336 glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB"); 00337 glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)wglGetProcAddress("glMultiTexCoord2fvARB"); 00338 00339 glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)wglGetProcAddress("glMultiTexCoord3fARB"); 00340 glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)wglGetProcAddress("glMultiTexCoord3fvARB"); 00341 00342 glMultiTexCoord4fARB = (PFNGLMULTITEXCOORD4FARBPROC)wglGetProcAddress("glMultiTexCoord4fARB"); 00343 glMultiTexCoord4fvARB = (PFNGLMULTITEXCOORD4FVARBPROC)wglGetProcAddress("glMultiTexCoord4fvARB"); 00344 00345 LOG_SUCCESS(("GL_ARB_multitexture supported!")); 00346 } 00347 else 00348 LOG_ERROR(("GL_ARB_multitexture not supported")); 00349 00350 00351 // ARB_point_parameters 00352 if (GL_ARB_point_parameters_supported = isExtensionSupported("GL_ARB_point_parameters")) { 00353 glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)wglGetProcAddress("glPointParameterfARB"); 00354 glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)wglGetProcAddress("glPointParameterfvARB"); 00355 00356 LOG_SUCCESS(("GL_ARB_point_parameters supported!")); 00357 } 00358 else 00359 LOG_ERROR(("GL_ARB_point_parameters not supported")); 00360 00361 00362 // ARB_vertex_buffer_object 00363 if (GL_ARB_vertex_buffer_object_supported = isExtensionSupported("GL_ARB_vertex_buffer_object")) { 00364 glBindBufferARB = (PFNGLBINDBUFFERARBPROC)wglGetProcAddress("glBindBufferARB"); 00365 glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)wglGetProcAddress("glDeleteBuffersARB"); 00366 glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)wglGetProcAddress("glGenBuffersARB"); 00367 glIsBufferARB = (PFNGLISBUFFERARBPROC)wglGetProcAddress("glIsBufferARB"); 00368 00369 glBufferDataARB = (PFNGLBUFFERDATAARBPROC)wglGetProcAddress("glBufferDataARB"); 00370 glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)wglGetProcAddress("glBufferSubDataARB"); 00371 glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)wglGetProcAddress("glGetBufferSubDataARB"); 00372 00373 glMapBufferARB = (PFNGLMAPBUFFERARBPROC)wglGetProcAddress("glMapBufferARB"); 00374 glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)wglGetProcAddress("glUnmapBufferARB"); 00375 00376 glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)wglGetProcAddress("glGetBufferParameterivARB"); 00377 glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)wglGetProcAddress("glGetBufferPointervARB"); 00378 00379 // hmm, remove this? 00380 if( !glBindBufferARB || !glDeleteBuffersARB || !glGenBuffersARB || 00381 !glIsBufferARB || !glBufferDataARB || !glBufferSubDataARB || 00382 !glGetBufferSubDataARB || !glMapBufferARB || !glUnmapBufferARB || 00383 !glGetBufferParameterivARB || !glGetBufferPointervARB ) { 00384 GL_ARB_vertex_buffer_object_supported = false; 00385 } 00386 00387 LOG_SUCCESS(("GL_ARB_vertex_buffer supported!")); 00388 } 00389 else 00390 LOG_ERROR(("GL_ARB_vertex_buffer not supported")); 00391 00392 00393 // GL_ARB_vertex_program 00394 GL_ARB_fragment_program_supported = isExtensionSupported("GL_ARB_fragment_program"); 00395 00396 00397 // GL_ARB_fragment_shader 00398 GL_ARB_fragment_shader_supported = isExtensionSupported("GL_ARB_fragment_shader"); 00399 00400 if (GL_ARB_fragment_shader_supported) 00401 LOG_SUCCESS(("GL_ARB_fragment_shader supported!")); 00402 else 00403 LOG_ERROR(("GL_ARB_fragment_shader not supported")); 00404 00405 00406 // GL_ARB_vertex_shader 00407 if (GL_ARB_vertex_shader_supported = isExtensionSupported("GL_ARB_vertex_shader")){ 00408 glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) wglGetProcAddress("glBindAttribLocationARB"); 00409 glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) wglGetProcAddress("glGetActiveAttribARB"); 00410 glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) wglGetProcAddress("glGetAttribLocationARB"); 00411 00412 LOG_SUCCESS(("GL_ARB_vertex_shader supported!")); 00413 } 00414 else 00415 LOG_ERROR(("GL_ARB_vertex_shader not supported")); 00416 00417 00418 // GL_ARB_vertex_program 00419 GL_ARB_vertex_program_supported = isExtensionSupported("GL_ARB_vertex_program"); 00420 00421 if (GL_ARB_vertex_program_supported || GL_ARB_fragment_program_supported){ 00422 glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC) wglGetProcAddress("glProgramStringARB"); 00423 glBindProgramARB = (PFNGLBINDPROGRAMARBPROC) wglGetProcAddress("glBindProgramARB"); 00424 glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC) wglGetProcAddress("glDeleteProgramsARB"); 00425 glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC) wglGetProcAddress("glGenProgramsARB"); 00426 00427 glProgramEnvParameter4dARB = (PFNGLPROGRAMENVPARAMETER4DARBPROC) wglGetProcAddress("glProgramEnvParameter4dARB"); 00428 glProgramEnvParameter4dvARB = (PFNGLPROGRAMENVPARAMETER4DVARBPROC) wglGetProcAddress("glProgramEnvParameter4dvARB"); 00429 glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC) wglGetProcAddress("glProgramEnvParameter4fARB"); 00430 glProgramEnvParameter4fvARB = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) wglGetProcAddress("glProgramEnvParameter4fvARB"); 00431 00432 glProgramLocalParameter4dARB = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC) wglGetProcAddress("glProgramLocalParameter4dARB"); 00433 glProgramLocalParameter4dvARB = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) wglGetProcAddress("glProgramLocalParameter4dvARB"); 00434 glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC) wglGetProcAddress("glProgramLocalParameter4fARB"); 00435 glProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) wglGetProcAddress("glProgramLocalParameter4fvARB"); 00436 00437 glGetProgramEnvParameterdvARB = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC) wglGetProcAddress("glGetProgramEnvParameterdvARB"); 00438 glGetProgramEnvParameterfvARB = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC) wglGetProcAddress("glGetProgramEnvParameterfvARB"); 00439 00440 glGetProgramLocalParameterdvARB = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) wglGetProcAddress("glGetProgramLocalParameterdvARB"); 00441 glGetProgramLocalParameterfvARB = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) wglGetProcAddress("glGetProgramLocalParameterfvARB"); 00442 00443 glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC) wglGetProcAddress("glGetProgramivARB"); 00444 glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC) wglGetProcAddress("glGetProgramStringARB"); 00445 glIsProgramARB = (PFNGLISPROGRAMARBPROC) wglGetProcAddress("glIsProgramARB"); 00446 } 00447 00448 if (GL_ARB_vertex_program_supported) 00449 LOG_SUCCESS(("GL_ARB_vertex_program supported!")); 00450 else 00451 LOG_ERROR(("GL_ARB_vertex_program not supported")); 00452 00453 if (GL_ARB_fragment_program_supported) 00454 LOG_SUCCESS(("GL_ARB_fragment_program supported!")); 00455 else 00456 LOG_ERROR(("GL_ARB_fragment_program not supported")); 00457 00458 00459 // GL_ARB_shader_objects 00460 if (GL_ARB_shader_objects_supported = isExtensionSupported("GL_ARB_shader_objects")){ 00461 glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) wglGetProcAddress("glDeleteObjectARB"); 00462 glGetHandleARB = (PFNGLGETHANDLEARBPROC) wglGetProcAddress("glGetHandleARB"); 00463 glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC) wglGetProcAddress("glDetachObjectARB"); 00464 glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) wglGetProcAddress("glCreateShaderObjectARB"); 00465 glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) wglGetProcAddress("glShaderSourceARB"); 00466 glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) wglGetProcAddress("glCompileShaderARB"); 00467 glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) wglGetProcAddress("glCreateProgramObjectARB"); 00468 glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) wglGetProcAddress("glAttachObjectARB"); 00469 glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) wglGetProcAddress("glLinkProgramARB"); 00470 glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) wglGetProcAddress("glUseProgramObjectARB"); 00471 glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC) wglGetProcAddress("glValidateProgramARB"); 00472 00473 glUniform1fARB = (PFNGLUNIFORM1FARBPROC) wglGetProcAddress("glUniform1fARB"); 00474 glUniform2fARB = (PFNGLUNIFORM2FARBPROC) wglGetProcAddress("glUniform2fARB"); 00475 glUniform3fARB = (PFNGLUNIFORM3FARBPROC) wglGetProcAddress("glUniform3fARB"); 00476 glUniform4fARB = (PFNGLUNIFORM4FARBPROC) wglGetProcAddress("glUniform4fARB"); 00477 00478 glUniform1iARB = (PFNGLUNIFORM1IARBPROC) wglGetProcAddress("glUniform1iARB"); 00479 glUniform2iARB = (PFNGLUNIFORM2IARBPROC) wglGetProcAddress("glUniform2iARB"); 00480 glUniform3iARB = (PFNGLUNIFORM3IARBPROC) wglGetProcAddress("glUniform3iARB"); 00481 glUniform4iARB = (PFNGLUNIFORM4IARBPROC) wglGetProcAddress("glUniform4iARB"); 00482 00483 glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC) wglGetProcAddress("glUniform1fvARB"); 00484 glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC) wglGetProcAddress("glUniform2fvARB"); 00485 glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC) wglGetProcAddress("glUniform3fvARB"); 00486 glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) wglGetProcAddress("glUniform4fvARB"); 00487 00488 glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC) wglGetProcAddress("glUniform1ivARB"); 00489 glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC) wglGetProcAddress("glUniform2ivARB"); 00490 glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) wglGetProcAddress("glUniform3ivARB"); 00491 glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) wglGetProcAddress("glUniform4ivARB"); 00492 00493 glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) wglGetProcAddress("glUniformMatrix2fvARB"); 00494 glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC) wglGetProcAddress("glUniformMatrix3fvARB"); 00495 glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC) wglGetProcAddress("glUniformMatrix4fvARB"); 00496 00497 glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC) wglGetProcAddress("glGetObjectParameterfvARB"); 00498 glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) wglGetProcAddress("glGetObjectParameterivARB"); 00499 glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) wglGetProcAddress("glGetInfoLogARB"); 00500 glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC) wglGetProcAddress("glGetAttachedObjectsARB"); 00501 glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) wglGetProcAddress("glGetUniformLocationARB"); 00502 glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC) wglGetProcAddress("glGetActiveUniformARB"); 00503 glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC) wglGetProcAddress("glGetUniformfvARB"); 00504 glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC) wglGetProcAddress("glGetUniformivARB"); 00505 glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC) wglGetProcAddress("glGetShaderSourceARB"); 00506 00507 LOG_SUCCESS(("GL_ARB_shader_objects supported!")); 00508 } 00509 else 00510 LOG_ERROR(("GL_ARB_shader_objects not supported")); 00511 00512 00513 // GL_ARB_shading_language_100 00514 GL_ARB_shading_language_100_supported = isExtensionSupported("GL_ARB_shading_language_100"); 00515 00516 if (GL_ARB_shading_language_100_supported) 00517 LOG_SUCCESS(("GL_ARB_shading_language_100 supported!")); 00518 else 00519 LOG_ERROR(("GL_ARB_shading_language_100 not supported")); 00520 00521 00522 // GL_ARB_occlusion_query 00523 if (GL_ARB_occlusion_query_supported = isExtensionSupported("GL_ARB_occlusion_query")){ 00524 glGenQueriesARB = (PFNGLGENQUERIESARBPROC) wglGetProcAddress("glGenQueriesARB"); 00525 glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC) wglGetProcAddress("glDeleteQueriesARB"); 00526 glIsQueryARB = (PFNGLISQUERYARBPROC) wglGetProcAddress("glIsQueryARB"); 00527 glBeginQueryARB = (PFNGLBEGINQUERYARBPROC) wglGetProcAddress("glBeginQueryARB"); 00528 glEndQueryARB = (PFNGLENDQUERYARBPROC) wglGetProcAddress("glEndQueryARB"); 00529 glGetQueryivARB = (PFNGLGETQUERYIVARBPROC) wglGetProcAddress("glGetQueryivARB"); 00530 glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC) wglGetProcAddress("glGetQueryObjectivARB"); 00531 glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC) wglGetProcAddress("glGetQueryObjectuivARB"); 00532 00533 LOG_SUCCESS(("GL_ARB_occlusion_query supported!")); 00534 } 00535 else 00536 LOG_ERROR(("GL_ARB_occlusion_query not supported")); 00537 00538 00539 // GL_NV_occlusion_query 00540 if (GL_NV_occlusion_query_supported = isExtensionSupported("GL_NV_occlusion_query")){ 00541 glGenOcclusionQueriesNV = (PFNGLGENOCCLUSIONQUERIESNVPROC) wglGetProcAddress("glGenOcclusionQueriesNV"); 00542 glDeleteOcclusionQueriesNV = (PFNGLDELETEOCCLUSIONQUERIESNVPROC) wglGetProcAddress("glDeleteOcclusionQueriesNV"); 00543 glIsOcclusionQueryNV = (PFNGLISOCCLUSIONQUERYNVPROC) wglGetProcAddress("glIsOcclusionQueryNV"); 00544 glBeginOcclusionQueryNV = (PFNGLBEGINOCCLUSIONQUERYNVPROC) wglGetProcAddress("glBeginOcclusionQueryNV"); 00545 glEndOcclusionQueryNV = (PFNGLENDOCCLUSIONQUERYNVPROC) wglGetProcAddress("glEndOcclusionQueryNV"); 00546 glGetOcclusionQueryivNV = (PFNGLGETOCCLUSIONQUERYIVNVPROC) wglGetProcAddress("glGetOcclusionQueryivNV"); 00547 glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC) wglGetProcAddress("glGetOcclusionQueryuivNV"); 00548 LOG_SUCCESS(("GL_NV_occlusion_query supported!")); 00549 } 00550 else 00551 LOG_ERROR(("GL_NV_occlusion_query not supported")); 00552 00553 00554 // WGL_ARB_pixel_format 00555 if (WGL_ARB_pixel_format_supported = isWGLXExtensionSupported("WGL_ARB_pixel_format")){ 00556 wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC) wglGetProcAddress("wglGetPixelFormatAttribivARB"); 00557 wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC) wglGetProcAddress("wglGetPixelFormatAttribfvARB"); 00558 wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC) wglGetProcAddress("wglChoosePixelFormatARB"); 00559 LOG_SUCCESS(("WGL_ARB_pixel_format supported!")); 00560 } 00561 else 00562 LOG_ERROR(("WGL_ARB_pixel_format not supported")); 00563 00564 return true; 00565 }