void ensureExtensionsInit() { #if !defined(SFML_OPENGL_ES) static bool initialized = false; if (!initialized) { initialized = true; sfogl_LoadFunctions(); // Retrieve the context version number int majorVersion = 0; int minorVersion = 0; // Try the new way first glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); glGetIntegerv(GL_MINOR_VERSION, &minorVersion); if (glGetError() == GL_INVALID_ENUM) { // Try the old way const GLubyte* version = glGetString(GL_VERSION); if (version) { // The beginning of the returned string is "major.minor" (this is standard) majorVersion = version[0] - '0'; minorVersion = version[2] - '0'; } else { // Can't get the version number, assume 1.1 majorVersion = 1; minorVersion = 1; } } if ((majorVersion < 1) || ((majorVersion == 1) && (minorVersion < 1))) { err() << "sfml-graphics requires support for OpenGL 1.1 or greater" << std::endl; err() << "Ensure that hardware acceleration is enabled if available" << std::endl; } } #endif }
void ensureExtensionsInit() { #if !defined(SFML_OPENGL_ES) static bool initialized = false; if (!initialized) { int loaded = sfogl_LoadFunctions(); if (!sfogl_IsVersionGEQ(1, 2)) { err() << "sfml-graphics requires support for OpenGL 1.2 or greater" << std::endl; err() << "Ensure that hardware acceleration is enabled if available" << std::endl; return; } if (loaded == sfogl_LOAD_FAILED) { err() << "Failed to initialize OpenGL 1.2 entry points, "; err() << "number of functions that failed to load: " << loaded - sfogl_LOAD_SUCCEEDED << std::endl; return; } bool missing = false; if (sfogl_ext_EXT_blend_minmax == sfogl_LOAD_FAILED) { err() << "Required extension EXT_blend_minmax unavailable" << std::endl; missing = true; } if (sfogl_ext_EXT_blend_subtract == sfogl_LOAD_FAILED) { err() << "Required extension EXT_blend_subtract unavailable" << std::endl; missing = true; } if (!missing) { initialized = true; } } #endif }