diff options
Diffstat (limited to 'android/jni/com/mapswithme/opengl/android_gl_utils.hpp')
-rw-r--r-- | android/jni/com/mapswithme/opengl/android_gl_utils.hpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/android/jni/com/mapswithme/opengl/android_gl_utils.hpp b/android/jni/com/mapswithme/opengl/android_gl_utils.hpp new file mode 100644 index 0000000000..17c910c53f --- /dev/null +++ b/android/jni/com/mapswithme/opengl/android_gl_utils.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include <EGL/egl.h> +#include <GLES2/gl2.h> + +namespace android +{ + +class ConfigComparator +{ +public: + ConfigComparator(EGLDisplay display) + : m_display(display) + {} + + int operator()(EGLConfig const & l, EGLConfig const & r) const + { + return configWeight(l) - configWeight(r); + } + + int configWeight(EGLConfig const & config) const + { + int val = -1; + eglGetConfigAttrib(m_display, config, EGL_CONFIG_CAVEAT, &val); + + switch (val) + { + case EGL_NONE: + return 0; + case EGL_SLOW_CONFIG: + return 1; + case EGL_NON_CONFORMANT_CONFIG: + return 2; + default: + return 0; + } + } + +private: + EGLDisplay m_display; +}; + +} // namespace android |