java.lang.Object
com.jozufozu.flywheel.backend.gl.versioned.GlCompat

public class GlCompat extends Object
An instance of this class stores information about what OpenGL features are available.
Each field stores an enum variant that provides access to the most appropriate version of a feature for the current system.
  • Field Details

    • instancedArrays

      public final InstancedArrays instancedArrays
    • bufferStorage

      public final BufferStorage bufferStorage
    • amd

      public final boolean amd
  • Method Details

    • getInstance

      public static GlCompat getInstance()
    • onAMDWindows

      public boolean onAMDWindows()
    • instancedArraysSupported

      public boolean instancedArraysSupported()
    • bufferStorageSupported

      public boolean bufferStorageSupported()
    • getLatest

      public static <V extends Enum<V> & GlVersioned> V getLatest(Class<V> clazz, org.lwjgl.opengl.GLCapabilities caps)
      Get the most compatible version of a specific OpenGL feature by iterating over enum constants in order.
      Type Parameters:
      V - The type of the versioning enum.
      Parameters:
      clazz - The class of the versioning enum.
      caps - The current system's supported features.
      Returns:
      The first defined enum variant to return true.
    • safeShaderSource

      public static void safeShaderSource(int glId, CharSequence source)
      Copied from:
      https://github.com/grondag/canvas/commit/820bf754092ccaf8d0c169620c2ff575722d7d96

      Identical in function to GL20C.glShaderSource(int, CharSequence) but passes a null pointer for string length to force the driver to rely on the null terminator for string length. This is a workaround for an apparent flaw with some AMD drivers that don't receive or interpret the length correctly, resulting in an access violation when the driver tries to read past the string memory.

      Hat tip to fewizz for the find and the fix.