Class GLUtils

java.lang.Object
org.oscim.renderer.GLUtils

public class GLUtils extends Object
Utility functions
  • Constructor Details

    • GLUtils

      public GLUtils()
  • Method Details

    • setColor

      public static void setColor(int location, int color)
      Set int color argb to uniform wxyz.
    • setColor

      public static void setColor(int location, int color, float alpha)
    • setColorBlend

      public static void setColorBlend(int location, int color1, int color2, float mix)
    • setTextureParameter

      public static void setTextureParameter(int min_filter, int mag_filter, int wrap_s, int wrap_t)
    • loadTexture

      public static int loadTexture(byte[] pixel, int width, int height, int format, int min_filter, int mag_filter, int wrap_s, int wrap_t)
    • checkFramebufferStatus

      public static int checkFramebufferStatus(String op)
      Check the status of current framebuffer. See: https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glCheckFramebufferStatus.xml
      Parameters:
      op - the operation which should be debugged
      Returns:
      the status code
    • getFramebufferStatusString

      public static String getFramebufferStatusString(int status)
      Parameters:
      status - the status code of a framebuffer
      Returns:
      the status code as string
    • checkGlError

      public static void checkGlError(String op)
      Check GL error. See: https://www.khronos.org/opengl/wiki/OpenGL_Error
      Parameters:
      op - the operation which should be debugged
    • checkGlError

      public static boolean checkGlError(String op, int id)
      Check GL error. See: https://www.khronos.org/opengl/wiki/OpenGL_Error
      Parameters:
      op - the operation which should be debugged
      id - the error to be found
      Returns:
      true if error was found
    • checkGlErrors

      public static List<Integer> checkGlErrors(String op)
      Check GL errors. See: https://www.khronos.org/opengl/wiki/OpenGL_Error
      Parameters:
      op - the operation which should be debugged
      Returns:
      the OpenGL error codes
    • getGlErrorString

      public static String getGlErrorString(int error)
      Parameters:
      error - the error code of OpenGL
      Returns:
      the error code as string
    • setColor

      public static void setColor(int handle, float[] c, float alpha)
    • colorToFloat

      public static float[] colorToFloat(int color)
    • colorToFloatP

      public static float[] colorToFloatP(int color)
    • changeSaturation

      public static void changeSaturation(float[] color, float change)
      public-domain function by Darel Rex Finley from http://alienryderflex.com/saturation.html
      Parameters:
      color - The passed-in RGB values can be on any desired scale, such as 0 to 1, or 0 to 255.
      change - 0.0 creates a black-and-white image. 0.5 reduces the color saturation by half. 1.0 causes no change. 2.0 doubles the color saturation.
    • glUniform3fv

      public static void glUniform3fv(int location, int count, float[] val)
    • glUniform4fv

      public static void glUniform4fv(int location, int count, float[] val)
    • glGenBuffers

      public static int[] glGenBuffers(int num)
    • glDeleteBuffers

      public static void glDeleteBuffers(int num, int[] ids)
    • glGenFrameBuffers

      public static int[] glGenFrameBuffers(int num)
    • glDeleteFrameBuffers

      public static void glDeleteFrameBuffers(int num, int[] ids)
    • glGenRenderBuffers

      public static int[] glGenRenderBuffers(int num)
    • glDeleteRenderBuffers

      public static void glDeleteRenderBuffers(int num, int[] ids)
    • glGenTextures

      public static int[] glGenTextures(int num)
    • glDeleteTextures

      public static void glDeleteTextures(int num, int[] ids)
    • glDrawBuffers

      public static void glDrawBuffers(int num, int[] glEnum)
      Specifies a list of color buffers to be drawn into.
      Parameters:
      num - Specifies the number of buffers in bufs.
      glEnum - Points to an array of symbolic constants specifying the buffers into which fragment colors or data values will be written.