Example usage for org.lwjgl.opengl ARBMultisample glSampleCoverageARB

List of usage examples for org.lwjgl.opengl ARBMultisample glSampleCoverageARB

Introduction

In this page you can find the example usage for org.lwjgl.opengl ARBMultisample glSampleCoverageARB.

Prototype

public static native void glSampleCoverageARB(@NativeType("GLfloat") float value,
        @NativeType("GLboolean") boolean invert);

Source Link

Document

Specifies simultaneously the values of #GL_SAMPLE_COVERAGE_VALUE_ARB SAMPLE_COVERAGE_VALUE_ARB and #GL_SAMPLE_COVERAGE_INVERT_ARB SAMPLE_COVERAGE_INVERT_ARB .

Usage

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

License:Open Source License

protected static void applySampleCoverage(final boolean enabled, final BlendState state,
        final BlendStateRecord record, final ContextCapabilities caps) {

    final boolean coverageInverted = state.isSampleCoverageInverted();
    final float coverageValue = state.getSampleCoverage();

    if (record.isValid()) {
        if (enabled) {
            if (!record.sampleCoverageEnabled) {
                GL11.glEnable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB);
                record.sampleCoverageEnabled = true;
            }//from   w w w . jav a 2 s  . c  o  m
            if (record.sampleCoverageInverted != coverageInverted || record.sampleCoverage != coverageValue) {
                ARBMultisample.glSampleCoverageARB(coverageValue, coverageInverted);
                record.sampleCoverageInverted = coverageInverted;
                record.sampleCoverage = coverageValue;
            }
        } else {
            if (record.sampleCoverageEnabled) {
                GL11.glDisable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB);
                record.sampleCoverageEnabled = false;
            }
        }
    } else {
        if (enabled) {
            GL11.glEnable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB);
            record.sampleCoverageEnabled = true;
            ARBMultisample.glSampleCoverageARB(coverageValue, coverageInverted);
            record.sampleCoverageInverted = coverageInverted;
            record.sampleCoverage = coverageValue;
        } else {
            GL11.glDisable(ARBMultisample.GL_SAMPLE_COVERAGE_ARB);
            record.sampleCoverageEnabled = false;
        }
    }
}