Example usage for org.lwjgl.opengl EXTBlendEquationSeparate glBlendEquationSeparateEXT

List of usage examples for org.lwjgl.opengl EXTBlendEquationSeparate glBlendEquationSeparateEXT

Introduction

In this page you can find the example usage for org.lwjgl.opengl EXTBlendEquationSeparate glBlendEquationSeparateEXT.

Prototype

public static native void glBlendEquationSeparateEXT(@NativeType("GLenum") int modeRGB,
            @NativeType("GLenum") int modeAlpha);

Source Link

Usage

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

License:Open Source License

protected static void applyBlendEquations(final boolean enabled, final BlendState state,
        final BlendStateRecord record, final ContextCapabilities caps) {
    if (record.isValid()) {
        if (enabled) {
            if (!record.blendEnabled) {
                GL11.glEnable(GL11.GL_BLEND);
                record.blendEnabled = true;
            }// w  w w  . j  av  a 2s .c  o  m
            final int blendEqRGB = getGLEquationValue(state.getBlendEquationRGB(), caps);
            if (caps.isSeparateBlendEquationsSupported()) {
                final int blendEqAlpha = getGLEquationValue(state.getBlendEquationAlpha(), caps);
                if (record.blendEqRGB != blendEqRGB || record.blendEqAlpha != blendEqAlpha) {
                    EXTBlendEquationSeparate.glBlendEquationSeparateEXT(blendEqRGB, blendEqAlpha);
                    record.blendEqRGB = blendEqRGB;
                    record.blendEqAlpha = blendEqAlpha;
                }
            } else if (caps.isBlendEquationSupported()) {
                if (record.blendEqRGB != blendEqRGB) {
                    ARBImaging.glBlendEquation(blendEqRGB);
                    record.blendEqRGB = blendEqRGB;
                }
            }
        } else if (record.blendEnabled) {
            GL11.glDisable(GL11.GL_BLEND);
            record.blendEnabled = false;
        }

    } else {
        if (enabled) {
            GL11.glEnable(GL11.GL_BLEND);
            record.blendEnabled = true;
            final int blendEqRGB = getGLEquationValue(state.getBlendEquationRGB(), caps);
            if (caps.isSeparateBlendEquationsSupported()) {
                final int blendEqAlpha = getGLEquationValue(state.getBlendEquationAlpha(), caps);
                EXTBlendEquationSeparate.glBlendEquationSeparateEXT(blendEqRGB, blendEqAlpha);
                record.blendEqRGB = blendEqRGB;
                record.blendEqAlpha = blendEqAlpha;
            } else if (caps.isBlendEquationSupported()) {
                ARBImaging.glBlendEquation(blendEqRGB);
                record.blendEqRGB = blendEqRGB;
            }
        } else {
            GL11.glDisable(GL11.GL_BLEND);
            record.blendEnabled = false;
        }
    }
}