Example usage for org.lwjgl.opengl GL14 GL_COMPARE_R_TO_TEXTURE

List of usage examples for org.lwjgl.opengl GL14 GL_COMPARE_R_TO_TEXTURE

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL14 GL_COMPARE_R_TO_TEXTURE.

Prototype

int GL_COMPARE_R_TO_TEXTURE

To view the source code for org.lwjgl.opengl GL14 GL_COMPARE_R_TO_TEXTURE.

Click Source Link

Document

Accepted by the param parameter of TexParameterf, TexParameteri, TexParameterfv, and TexParameteriv when the pname parameter is TEXTURE_COMPARE_MODE.

Usage

From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Texture.java

License:MIT License

@Override
public void setCompareMode(CompareMode compareMode) {
    checkCreated();//from  ww w  .j  av a 2s  . com
    if (compareMode == null) {
        throw new IllegalArgumentException("Compare mode cannot be null");
    }
    // Bind the texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, id);
    // Note: GL14.GL_COMPARE_R_TO_TEXTURE and GL30.GL_COMPARE_REF_TO_TEXTURE are the same, just a different name
    // No need for a different call in the GL30 implementation
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_MODE, GL14.GL_COMPARE_R_TO_TEXTURE);
    // Set the compare mode
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_FUNC, compareMode.getGLConstant());
    // Unbind the texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    // Check for errors
    LWJGLUtil.checkForGLError();
}