blob: 37ec4517812e18267ff29d00bd46ff322bdda1e3 [file] [log] [blame] [raw]
package li.cil.oc.util
import net.minecraft.client.renderer.OpenGlHelper
import org.lwjgl.opengl.{ARBMultitexture, GLContext, GL11, GL13}
object RenderState {
val arb = GLContext.getCapabilities.GL_ARB_multitexture && !GLContext.getCapabilities.OpenGL13
def disableLighting() {
GL11.glDisable(GL11.GL_LIGHTING)
if (arb) {
ARBMultitexture.glActiveTextureARB(OpenGlHelper.lightmapTexUnit)
GL11.glDisable(GL11.GL_TEXTURE_2D)
ARBMultitexture.glActiveTextureARB(OpenGlHelper.defaultTexUnit)
}
else {
GL13.glActiveTexture(OpenGlHelper.lightmapTexUnit)
GL11.glDisable(GL11.GL_TEXTURE_2D)
GL13.glActiveTexture(OpenGlHelper.defaultTexUnit)
}
}
def makeItBlend() {
GL11.glEnable(GL11.GL_BLEND)
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR)
GL11.glDepthFunc(GL11.GL_LEQUAL)
}
}