static const gl_param_t* get_gl_param() { if (!QOpenGLContext::currentContext()) { qWarning("%s: current context is null", __FUNCTION__); return gl_param_compat; } static gl_param_t* gp = 0; if (gp) return gp; bool has_16 = false; // [4] is always available if (test_gl_param(gl_param_desktop[4], &has_16)) { if (has_16 && depth16BitTexture() == 16) gp = (gl_param_t*)gl_param_desktop; else gp = (gl_param_t*)gl_param_desktop_fallback; has_16_tex = has_16; if (!useDeprecatedFormats()) { qDebug("using gl_param_desktop%s", gp == gl_param_desktop? "" : "_fallback"); return gp; } } else if (test_gl_param(gl_param_es3[4], &has_16)) { gp = (gl_param_t*)gl_param_es3; has_16_tex = has_16; if (!useDeprecatedFormats()) { qDebug("using gl_param_es3"); return gp; } } qDebug("fallback to gl_param_compat"); gp = (gl_param_t*)gl_param_compat; has_16_tex = false; return gp; }
static const gl_param_t* get_gl_param() { if (!QOpenGLContext::currentContext()) { qWarning("%s: current context is null", __FUNCTION__); return gl_param_compat; } static gl_param_t* gp = 0; if (gp) return gp; bool has_16 = false; // [4] is always available if (test_gl_param(gl_param_desktop[4], &has_16)) { if (has_16 && depth16BitTexture() == 16) gp = (gl_param_t*)gl_param_desktop; else gp = (gl_param_t*)gl_param_desktop_fallback; has_16_tex = has_16; if (!useDeprecatedFormats()) { qDebug("using gl_param_desktop%s", gp == gl_param_desktop? "" : "_fallback"); return gp; } } else if (test_gl_param(gl_param_es3[4], &has_16)) { //3.0 will fail because no glGetTexLevelParameteriv gp = (gl_param_t*)gl_param_es3; has_16_tex = has_16; if (!useDeprecatedFormats()) { qDebug("using gl_param_es3"); return gp; } } else if (isOpenGLES()) { if (QOpenGLContext::currentContext()->format().majorVersion() > 2) gp = (gl_param_t*)gl_param_es3; //for 3.0 else if (hasRG()) gp = (gl_param_t*)gl_param_es2rg; has_16_tex = has_16; if (gp && !useDeprecatedFormats()) { qDebug("using gl_param_%s", gp == gl_param_es3 ? "es3" : "es2rg"); return gp; } } qDebug("fallback to gl_param_compat"); gp = (gl_param_t*)gl_param_compat; has_16_tex = false; return gp; }