|
From: Frank C. <dev...@ch...> - 2004-09-29 18:26:37
|
Hmmm, GLUtils_CheckExtensions looks like it has some problems... First, the version check is flawed: if ( (majorVers >= 1) && (minorVers >= 2) ) would make more sense as: if ( (majorVers > 1) || ((majorVers == 1) && (minorVers >= 2)) ) Or else a version like "2.0" will get bypassed. The minor version can easily be two digits though, and "15" shouldn't be greater than "2" in this case, so it's broken anyway... Apple's glCheck code converts the GL_VERSION string into a BCD for comparisons <http://developer.apple.com/samplecode/Carbon_AGL_Full_Screen/ listing2.html> Quesa should probably do the same, something like this: ------ void GLUtils_CheckExtensions( TQ3GLExtensions* featureFlags ) { const char* openGLVersion = (const char*)glGetString( GL_VERSION ); const char* openGLExtensions = (const char*)glGetString( GL_EXTENSIONS ); short j = 0; short shiftVal = 8; unsigned short glVersion = 0; // Initialize to default value, all off. memset( featureFlags, 0, sizeof(TQ3GLExtensions) ); if (openGLVersion != NULL) { // Get BCD version. while (((openGLVersion[j] <= '9') && (openGLVersion[j] >= '0')) || (openGLVersion[j] == '.')) { if ((openGLVersion[j] <= '9') && (openGLVersion[j] >= '0')) { glVersion += (openGLVersion[j] - '0') << shiftVal; shiftVal -= 4; } j++; } // Check for extensions. if ( glVersion >= 0x0120 || isOpenGLExtensionPresent( openGLExtensions, "GL_EXT_separate_specular_color" ) ) { featureFlags->separateSpecularColor = kQ3True; } if ( glVersion >= 0x0120 || isOpenGLExtensionPresent( openGLExtensions, "GL_EXT_texture_edge_clamp" ) || isOpenGLExtensionPresent( openGLExtensions, "GL_SGIS_texture_edge_clamp" ) ) { featureFlags->clampToEdge = kQ3True; } } } ------ Note: I added the GL_SGIS_texture_edge_clamp check as well. I've updated my patch archive with these changes, but for some reason I'm not convinced GL_VERSION is always correct (though Apple seems to depend on it). What OS are you running that returns OpenGL 1.15? Thanks, Frank. On 29-Sep-04, at 12:42 PM, Daniele Cavallini wrote: > I am using OpenGL 1.15. The value is obtained from glGetString( > GL_VERSION ). > When exit from GLUtils_CheckExtensions featureFlags->clampToEdge is > set to kQ3True; > I obtain: > majorVers = 1 > minorVers = 15 > after the step > int numScanned = sscanf( openGLVersion, "%d.%d", > &majorVers, &minorVers ); > It is Correct? > Daniele > > At 18.06 29/09/04, you wrote: >> No, that'll break it... >> >> The value will be false to start (the struct is zeroed in the >> function) and is set to true if using OpenGL 1.2+. The extension may >> not exist in an OpenGL 1.2+ implementation though, so you'll be >> setting it back to false even though it can be handled just fine at >> that point. The extension check is strictly for older OpenGL versions >> before the ARB ratified the function. >> >> Frank. >> >> On 29-Sep-04, at 10:59 AM, Daniele Cavallini wrote: >> >>> Question: >>> Is It better add this "else" in function "GLUtils_CheckExtensions"? >>> >>> if (isOpenGLExtensionPresent( openGLExtensions, >>> GL_EXT_texture_edge_clamp" )) >>> { >>> featureFlags->clampToEdge = kQ3True; >>> } >>> else >>> featureFlags->clampToEdge = kQ3False; >>> Daniele >>> >>> At 01.50 29/09/04, you wrote: >>>> Here: <http://chaoticbox.com/quesa901422.zip> is a small patch that >>>> checks for CLAMP_TO_EDGE and uses it when available for texture >>>> shaders >>>> that have a kQ3ShaderUVBoundaryClamp setting. The original report is >>>> here: >>>> <http://sourceforge.net/tracker/index.php? >>>> func=detail&aid=901422&group_id=45158&atid=442052> >>>> >>>> On a similar note; Is there a better way to submit patches? Do you >>>> guys >>>> prefer some sort of diff tool output? If so, please let me know... |