Retain GLUtil.maxTextureSize

This commit is contained in:
arkon 2021-09-05 14:34:54 -04:00
parent ec4e631760
commit ee20787c5e

View File

@ -5,13 +5,8 @@ import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.egl.EGLContext
import kotlin.math.max
class GLUtil private constructor() {
companion object {
// Safe minimum default size
private const val IMAGE_MAX_BITMAP_DIMENSION = 2048
val maxTextureSize: Int
get() {
object GLUtil {
val maxTextureSize: Int by lazy {
// Get EGL Display
val egl = EGLContext.getEGL() as EGL10
val display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY)
@ -44,11 +39,9 @@ class GLUtil private constructor() {
egl.eglTerminate(display)
// Return largest texture size found, or default
return max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION)
max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION)
}
}
init {
throw InstantiationException("This class is not for instantiation")
}
}
// Safe minimum default size
private const val IMAGE_MAX_BITMAP_DIMENSION = 2048