Example usage for org.lwjgl.opengl ARBShadow GL_TEXTURE_COMPARE_MODE_ARB

List of usage examples for org.lwjgl.opengl ARBShadow GL_TEXTURE_COMPARE_MODE_ARB

Introduction

In this page you can find the example usage for org.lwjgl.opengl ARBShadow GL_TEXTURE_COMPARE_MODE_ARB.

Prototype

int GL_TEXTURE_COMPARE_MODE_ARB

To view the source code for org.lwjgl.opengl ARBShadow GL_TEXTURE_COMPARE_MODE_ARB.

Click Source Link

Document

Accepted by the pname parameter of TexParameterf, TexParameteri, TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv.

Usage

From source file:com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil.java

License:Open Source License

/**
 * Check if the filter settings of this particular texture have been changed and apply as needed.
 * // w  w w  . j a v a 2  s . c o  m
 * @param texture
 *            our texture object
 * @param texRecord
 *            our record of the last state of the texture in gl
 * @param record
 */
public static void applyShadow(final Texture texture, final TextureRecord texRecord, final int unit,
        final TextureStateRecord record, final ContextCapabilities caps) {
    final Type type = texture.getType();

    if (caps.isDepthTextureSupported()) {
        final int depthMode = LwjglTextureUtil.getGLDepthTextureMode(texture.getDepthMode());
        // set up magnification filter
        if (!texRecord.isValid() || texRecord.depthTextureMode != depthMode) {
            checkAndSetUnit(unit, record, caps);
            GL11.glTexParameteri(getGLType(type), ARBDepthTexture.GL_DEPTH_TEXTURE_MODE_ARB, depthMode);
            texRecord.depthTextureMode = depthMode;
        }
    }

    if (caps.isARBShadowSupported()) {
        final int depthCompareMode = LwjglTextureUtil
                .getGLDepthTextureCompareMode(texture.getDepthCompareMode());
        // set up magnification filter
        if (!texRecord.isValid() || texRecord.depthTextureCompareMode != depthCompareMode) {
            checkAndSetUnit(unit, record, caps);
            GL11.glTexParameteri(getGLType(type), ARBShadow.GL_TEXTURE_COMPARE_MODE_ARB, depthCompareMode);
            texRecord.depthTextureCompareMode = depthCompareMode;
        }

        final int depthCompareFunc = LwjglTextureUtil
                .getGLDepthTextureCompareFunc(texture.getDepthCompareFunc());
        // set up magnification filter
        if (!texRecord.isValid() || texRecord.depthTextureCompareFunc != depthCompareFunc) {
            checkAndSetUnit(unit, record, caps);
            GL11.glTexParameteri(getGLType(type), ARBShadow.GL_TEXTURE_COMPARE_FUNC_ARB, depthCompareFunc);
            texRecord.depthTextureCompareFunc = depthCompareFunc;
        }
    }
}