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 TypeMethodDescriptionvoidactiveTexture(int unit) Selects the active texture unit.voidbindTexture(int texture) Binds a 2D texture on the active unit.voidblend(boolean on) Enables or disables blending.voidblendFunc(int srcRgb, int dstRgb, int srcAlpha, int dstAlpha) Sets the separate blend factors.voidcolorMask(boolean r, boolean g, boolean b, boolean a) Sets which colour channels are written.voidcull(boolean on) Enables or disables face culling.voiddepthMask(boolean write) Sets the depth write mask.voiddepthTest(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 factordstRgb- destination RGB factorsrcAlpha- source alpha factordstAlpha- 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_TEXTURE0plus 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- redg- greenb- bluea- alpha
-