public final class GlUtil extends Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
GlUtil.Attribute |
GL attribute, which can be attached to a buffer with
GlUtil.Attribute.setBuffer(float[], int). |
static class |
GlUtil.Uniform |
GL uniform, which can be attached to a sampler using
GlUtil.Uniform.setSamplerTexId(int, int). |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
checkGlError() |
If there is an OpenGl error, logs the error and if
ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED is true throws a RuntimeException. |
static int |
compileProgram(String[] vertexCode,
String[] fragmentCode) |
Builds a GL shader program from vertex and fragment shader code.
|
static int |
compileProgram(String vertexCode,
String fragmentCode) |
Builds a GL shader program from vertex and fragment shader code.
|
static FloatBuffer |
createBuffer(float[] data) |
Allocates a FloatBuffer with the given data.
|
static FloatBuffer |
createBuffer(int capacity) |
Allocates a FloatBuffer.
|
static int |
createExternalTexture() |
Creates a GL_TEXTURE_EXTERNAL_OES with default configuration of GL_LINEAR filtering and
GL_CLAMP_TO_EDGE wrapping.
|
static GlUtil.Attribute[] |
getAttributes(int program) |
Returns the
GlUtil.Attributes in the specified program. |
static GlUtil.Uniform[] |
getUniforms(int program) |
Returns the
GlUtil.Uniforms in the specified program. |
static boolean |
isProtectedContentExtensionSupported(Context context) |
Returns whether creating a GL context with "EGL_EXT_protected_content" is possible.
|
static boolean |
isSurfacelessContextExtensionSupported() |
Returns whether creating a GL context with "EGL_KHR_surfaceless_context" is possible.
|
public static boolean isProtectedContentExtensionSupported(Context context)
true, the device supports a protected output path for DRM content when using GL.public static boolean isSurfacelessContextExtensionSupported()
public static void checkGlError()
ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED is true throws a RuntimeException.public static int compileProgram(String[] vertexCode, String[] fragmentCode)
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.public static int compileProgram(String vertexCode, String fragmentCode)
vertexCode - GLES20 vertex shader program.fragmentCode - GLES20 fragment shader program.public static GlUtil.Attribute[] getAttributes(int program)
GlUtil.Attributes in the specified program.public static GlUtil.Uniform[] getUniforms(int program)
GlUtil.Uniforms in the specified program.public static FloatBuffer createBuffer(float[] data)
data - Used to initialize the new buffer.public static FloatBuffer createBuffer(int capacity)
capacity - The new buffer's capacity, in floats.public static int createExternalTexture()