Class GlUtil


  • public final class GlUtil
    extends Object
    GL utilities.
    • Method Detail

      • isProtectedContentExtensionSupported

        public static boolean isProtectedContentExtensionSupported​(Context context)
        Returns whether creating a GL context with "EGL_EXT_protected_content" is possible. If true, the device supports a protected output path for DRM content when using GL.
      • isSurfacelessContextExtensionSupported

        public static boolean isSurfacelessContextExtensionSupported()
        Returns whether creating a GL context with "EGL_KHR_surfaceless_context" is possible.
      • compileProgram

        public static int compileProgram​(String[] vertexCode,
                                         String[] fragmentCode)
        Builds a GL shader program from vertex and fragment shader code.
        Parameters:
        vertexCode - GLES20 vertex shader program as arrays of strings. Strings are joined by adding a new line character in between each of them.
        fragmentCode - GLES20 fragment shader program as arrays of strings. Strings are joined by adding a new line character in between each of them.
        Returns:
        GLES20 program id.
      • compileProgram

        public static int compileProgram​(String vertexCode,
                                         String fragmentCode)
        Builds a GL shader program from vertex and fragment shader code.
        Parameters:
        vertexCode - GLES20 vertex shader program.
        fragmentCode - GLES20 fragment shader program.
        Returns:
        GLES20 program id.
      • createBuffer

        public static FloatBuffer createBuffer​(float[] data)
        Allocates a FloatBuffer with the given data.
        Parameters:
        data - Used to initialize the new buffer.
      • createBuffer

        public static FloatBuffer createBuffer​(int capacity)
        Allocates a FloatBuffer.
        Parameters:
        capacity - The new buffer's capacity, in floats.
      • createExternalTexture

        public static int createExternalTexture()
        Creates a GL_TEXTURE_EXTERNAL_OES with default configuration of GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping.