Пример #1
0
int arglGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension)
{
    const GLubyte *strVersion;
    const GLubyte *strExtensions;
    short j, shiftVal;
    unsigned short version = 0; // binary-coded decimal gl version (ie. 1.4 is 0x0140).
    
    if (minVersion > 0) {
        strVersion = glGetString(GL_VERSION);
#ifdef EDEN_OPENGLES
        j = 13; // Of the form "OpenGL ES-XX 1.1", where XX=CM for common, CL for common lite.
#else
        j = 0;
#endif
        shiftVal = 8;
        // Construct BCD version.
        while (((strVersion[j] <= '9') && (strVersion[j] >= '0')) || (strVersion[j] == '.')) { // Get only basic version info (until first non-digit or non-.)
            if ((strVersion[j] <= '9') && (strVersion[j] >= '0')) {
                version += (strVersion[j] - '0') << shiftVal;
                shiftVal -= 4;
            }
            j++;
        }
        if (version >= minVersion) return (TRUE);
    }
    
    if (extension) {
        strExtensions = glGetString(GL_EXTENSIONS);
        if (arglGluCheckExtension(extension, strExtensions)) return (TRUE);
    }
    
    return (FALSE);
}
Пример #2
0
//
//  Checks for the presence of an OpenGL capability by version or extension.
//  Reports whether the current OpenGL driver's OpenGL implementation version
//  meets or exceeds a minimum value passed in in minVersion (represented as a binary-coded
//  decimal i.e. version 1.0 is represented as 0x0100). If minVersion is zero, the
//  version test will always fail. Alternately, the test is satisfied if an OpenGL extension
//  identifier passed in as a character string
//  is non-NULL, and is found in the current driver's list of supported extensions.
//  Returns: TRUE If either of the tests passes, or FALSE if both fail.
//
static int arglGLCapabilityCheck(const unsigned short minVersion, const unsigned char *extension)
{
	const GLubyte * strRenderer;
	const GLubyte * strVersion;
	const GLubyte * strVendor;
	const GLubyte * strExtensions;
	short j, shiftVal;
	unsigned short version = 0; // binary-coded decimal gl version (ie. 1.4 is 0x0140).
	
	strRenderer = glGetString(GL_RENDERER);
	strVendor = glGetString(GL_VENDOR);
	strVersion = glGetString(GL_VERSION);
	j = 0;
	shiftVal = 8;
	// Construct BCD version.
	while (((strVersion[j] <= '9') && (strVersion[j] >= '0')) || (strVersion[j] == '.')) { // Get only basic version info (until first non-digit or non-.)
		if ((strVersion[j] <= '9') && (strVersion[j] >= '0')) {
			version += (strVersion[j] - '0') << shiftVal;
			shiftVal -= 4;
		}
		j++;
	}
	strExtensions = glGetString(GL_EXTENSIONS);
	
	if (0 < minVersion && version >= minVersion) return (TRUE);
	if (extension && arglGluCheckExtension(extension, strExtensions)) return (TRUE);
	return (FALSE);
}