-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6411 from grzesiek2010/COLLECT-6410
Don't require OpenGL 3.0
- Loading branch information
Showing
4 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
androidshared/src/main/java/org/odk/collect/androidshared/system/OpenGLVersionChecker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.odk.collect.androidshared.system | ||
|
||
import android.app.ActivityManager | ||
import android.content.Context | ||
|
||
/** | ||
* Checks if the device supports the given OpenGL ES version. | ||
* | ||
* Note: This approach may not be 100% reliable because `reqGlEsVersion` indicates | ||
* the highest version of OpenGL ES that the device's hardware is guaranteed to support | ||
* at runtime. However, it might not always reflect the actual version available. | ||
* | ||
* For a more reliable method, refer to https://developer.android.com/develop/ui/views/graphics/opengl/about-opengl#version-check. | ||
* This recommended approach is more complex to implement but offers better accuracy. | ||
*/ | ||
object OpenGLVersionChecker { | ||
@JvmStatic | ||
fun isOpenGLv2Supported(context: Context): Boolean { | ||
return (context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager) | ||
.deviceConfigurationInfo.reqGlEsVersion >= 0x20000 | ||
} | ||
|
||
@JvmStatic | ||
fun isOpenGLv3Supported(context: Context): Boolean { | ||
return (context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager) | ||
.deviceConfigurationInfo.reqGlEsVersion >= 0x30000 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters