View Full Version : WGL_ARB_render_texture
eggzcape
03-07-2008, 09:52 AM
WGL_ARB_render_texture its not on my glGetString(GL_EXTENSIONS) but wglGetProcAddress('wglBindTexImageARB'); works am i looking for the wrong name?
Mark Shaxted
03-07-2008, 10:14 AM
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress( "wglGetExtensionsStringARB" );
PFNWGLGETEXTENSIONSSTRINGEXTPROC wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) wglGetProcAddress( "wglGetExtensionsStringEXT" );
bool IsExtensionSupported( char *szExtension )
{
char *extensionList;
int extensionListLen = 0;
int extensionLen = 0;
if( szExtension[0] == 'G' )
{
extensionList = (char*) glGetString( GL_EXTENSIONS );
}
else if( szExtension[0] == 'W' )
{
if( wglGetExtensionsStringARB )
{
extensionList = (char*) wglGetExtensionsStringARB( wglGetCurrentDC() );
}
else if ( wglGetExtensionsStringEXT )
{
extensionList = (char*) wglGetExtensionsStringEXT();
}
else
{
return false;
}
}
else
{
return false;
}
while( extensionList[extensionListLen] != 0 ) extensionListLen++; // equivalent to strlen
while( szExtension[extensionLen] != 0 ) extensionLen++;
for( int start = 0; start < extensionListLen; start++ )
{
if( extensionList[start] > ' ' ) // find next non-space character
{
int end = start;
while( end < extensionListLen && extensionList[end] > ' ' ) end++;
if( end - start == extensionLen ) // current extension in list is same length as extension to find
{
bool match = true; // assume a match until proven otherwise
for( int i = 0; i < extensionLen; i++ )
{
if( szExtension[i] != extensionList[start + i] )
{
match = false;
break;
}
}
if( match ) return true;
}
start = end;
}
}
return false;
}
The extension name is correct. The above code is what I use to check for extensions. It just checks the length (in chars) of the extension name you pass it, and for each extension in the list with the same length does a binary comparison - returning true if a match is found, otherwise false.
Modify as you desire :)
eggzcape
03-07-2008, 10:22 AM
problem solved, thank you!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.