Interface GlStateCache

All Known Implementing Classes:
DirectGlStateCache, MinecraftGlStateCache

public interface GlStateCache
The state a host caches on the CPU side, such as Minecraft's GlStateManager.

A host that caches GL state skips a call when its cache already holds the value, so a change made behind its back leaves the cache wrong and a later vanilla or OptiFine call silently does nothing. Every change to these states therefore goes through this interface. DirectGlStateCache is the implementation for a host with no cache.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activeTexture(int unit)
    Selects the active texture unit.
    void
    bindTexture(int texture)
    Binds a 2D texture on the active unit.
    void
    blend(boolean on)
    Enables or disables blending.
    void
    blendFunc(int srcRgb, int dstRgb, int srcAlpha, int dstAlpha)
    Sets the separate blend factors.
    void
    colorMask(boolean r, boolean g, boolean b, boolean a)
    Sets which colour channels are written.
    void
    cull(boolean on)
    Enables or disables face culling.
    void
    depthMask(boolean write)
    Sets the depth write mask.
    void
    depthTest(boolean on)
    Enables or disables the depth test.
  • Method Details

    • blend

      void blend(boolean on)
      Enables or disables blending.
      Parameters:
      on - whether blending is on
    • blendFunc

      void blendFunc(int srcRgb, int dstRgb, int srcAlpha, int dstAlpha)
      Sets the separate blend factors.
      Parameters:
      srcRgb - source RGB factor
      dstRgb - destination RGB factor
      srcAlpha - source alpha factor
      dstAlpha - destination alpha factor
    • depthTest

      void depthTest(boolean on)
      Enables or disables the depth test.
      Parameters:
      on - whether the depth test is on
    • depthMask

      void depthMask(boolean write)
      Sets the depth write mask.
      Parameters:
      write - whether depth writes are on
    • cull

      void cull(boolean on)
      Enables or disables face culling.
      Parameters:
      on - whether culling is on
    • activeTexture

      void activeTexture(int unit)
      Selects the active texture unit.
      Parameters:
      unit - GL_TEXTURE0 plus the unit number
    • bindTexture

      void bindTexture(int texture)
      Binds a 2D texture on the active unit.
      Parameters:
      texture - the texture
    • colorMask

      void colorMask(boolean r, boolean g, boolean b, boolean a)
      Sets which colour channels are written.
      Parameters:
      r - red
      g - green
      b - blue
      a - alpha