Browse Source

Detecting whether ANGLE is used as GLES2 implementation.

pull/55/merge
Vladimír Vondruš 12 years ago
parent
commit
fcea05e316
  1. 12
      src/Magnum/Context.h
  2. 11
      src/Magnum/Implementation/detectedDriver.cpp

12
src/Magnum/Context.h

@ -178,7 +178,17 @@ class MAGNUM_EXPORT Context {
enum class DetectedDriver: UnsignedShort {
#ifndef MAGNUM_TARGET_GLES
/** Binary AMD desktop drivers on Windows and Linux */
AMD = 1 << 0
AMD = 1 << 0,
#endif
#ifdef MAGNUM_TARGET_GLES2
/**
* OpenGL ES 2.0 implementation by ANGLE (translated to D3D9), used
* by browsers on Windows for Native Client and WebGL. As the WebGL
* specification explicitly disallows exposing driver information
* to the application, this check cannot be done reliably.
*/
ProbablyAngle = 1 << 1
#endif
};

11
src/Magnum/Implementation/detectedDriver.cpp

@ -40,6 +40,17 @@ auto Context::detectedDriver() -> Context::DetectedDrivers {
return *_detectedDrivers |= DetectedDriver::AMD;
#endif
/* OpenGL ES 2.0 implementation using ANGLE. Taken from
http://stackoverflow.com/a/20149090 */
#ifdef MAGNUM_TARGET_GLES2
{
Range1Di range;
glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range.data());
if(range.min() == 1 && range.max() == 1)
return *_detectedDrivers |= DetectedDriver::ProbablyAngle;
}
#endif
return *_detectedDrivers;
}

Loading…
Cancel
Save