Class GlUtils

java.lang.Object
com.banuba.sdk.internal.gl.GlUtils

public final class GlUtils extends Object
  • Field Details

  • Method Details

    • copyMatrix

      public static void copyMatrix(@NonNull float[] src, @NonNull float[] dest)
    • getIdentityMatrix

      public static float[] getIdentityMatrix()
    • getNewIdentityMatrix

      public static float[] getNewIdentityMatrix()
    • initFloatBuffer

      public static FloatBuffer initFloatBuffer(float[] inFloatArray)
    • initColorArray

      public static void initColorArray(float[] colorArray, int iColor)
    • detectOpenGLES20

      public static boolean detectOpenGLES20(android.content.Context context)
    • loadShader

      public static int loadShader(int shaderType, String source)
      Compiles the provided shader source.
      Returns:
      A handle to the shader, or 0 on failure.
    • loadProgram

      public static int loadProgram(@NonNull String vertShaderSrc, @NonNull String fragShaderSrc)
    • loadTextureFromFile

      public static int loadTextureFromFile(@NonNull File file)
    • loadTextureFromBitmap

      public static int loadTextureFromBitmap(@NonNull android.graphics.Bitmap bitmap)
    • loadTextureFromRawRes

      public static int loadTextureFromRawRes(@RawRes int resID, android.content.Context context)
    • createTextureFromDrawable

      public static int createTextureFromDrawable(android.graphics.drawable.Drawable drawable, int width, int height)
    • loadTextureLuminance

      public static int loadTextureLuminance(@NonNull ByteBuffer buffer, int width, int height, int format)
    • createExternalTextureObject

      public static int createExternalTextureObject()
    • setupBlend

      public static void setupBlend()
    • printGlInfo

      public static void printGlInfo()
    • setupVertexBuffer

      public static int setupVertexBuffer(float[] vertexArray)
    • setupVertexTextureBuffers

      public static int[] setupVertexTextureBuffers(float[] vertexArray, float[] textureArray)
    • multiplyMM

      public static void multiplyMM(float[] result, float[] lhs, float[] rhs)
    • multiplyMM4

      public static void multiplyMM4(float[] result, float[] mat1, float[] mat2, float[] mat3, float[] mat4)
    • checkGlError

      public static void checkGlError(String op)
      Checks to see if a GLES error has been raised.
    • checkGlErrorNoException

      public static void checkGlErrorNoException(String op)
    • setupSampler

      public static void setupSampler(int samplerIndex, int location, int texture, boolean external)
    • createProgram

      public static int createProgram(String vertexSource, String fragmentSource)
      Creates a new program from the supplied vertex and fragment shaders.
      Returns:
      A handle to the program, or 0 on failure.
    • checkLocation

      public static void checkLocation(int location, String label)
      Checks to see if the location we obtained is valid. GLES returns -1 if a label could not be found, but does not set the GL error.

      Throws a RuntimeException if the location is invalid.

    • createImageTexture

      public static int createImageTexture(ByteBuffer data, int width, int height, int format)
      Creates a texture from raw data.
      Parameters:
      data - Image data, in a "direct" ByteBuffer.
      width - Texture width, in pixels (not bytes).
      height - Texture height, in pixels.
      format - Image data format (use constant appropriate for glTexImage2D(), e.g. GL_RGBA).
      Returns:
      Handle to texture.
    • createFloatBuffer

      public static FloatBuffer createFloatBuffer(float[] coords)
      Allocates a direct float buffer, and populates it with the float array data.
    • logVersionInfo

      public static void logVersionInfo()
      Writes GL version info to the log.
    • calculateCameraMatrix

      public static void calculateCameraMatrix(float[] matrix, float angle, int flip)