Example usage for org.lwjgl.opengl GL11 glAlphaFunc

List of usage examples for org.lwjgl.opengl GL11 glAlphaFunc

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glAlphaFunc.

Prototype

public static native void glAlphaFunc(@NativeType("GLenum") int func, @NativeType("GLfloat") float ref);

Source Link

Document

The alpha test discards a fragment conditionally based on the outcome of a comparison between the incoming fragment’s alpha value and a constant value.

Usage

From source file:vazkii.b_baubles.client.fx.ParticleRenderDispatcher.java

License:Creative Commons License

public static void dispatch() {
    Tessellator tessellator = Tessellator.instance;

    boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;

    GL11.glDepthMask(false);// www. ja  va 2 s.  c  o  m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    if (isLightingEnabled)
        GL11.glDisable(GL11.GL_LIGHTING);

    profiler.startSection("sparkle");
    FXSparkle.dispatchQueuedRenders(tessellator);
    profiler.endStartSection("wisp");
    FXWisp.dispatchQueuedRenders(tessellator);
    profiler.endSection();

    if (isLightingEnabled)
        GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:zsawyer.mods.stereoscopic3d.MinecraftCopy.java

License:Open Source License

/**
 * Displays a new screen./*from  w  w w.  jav  a  2  s  . com*/
 */
public static void loadScreen() throws LWJGLException {
    ScaledResolution var1 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    GL11.glClear(16640);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
    GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
    GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_FOG);
    Tessellator var2 = Tessellator.instance;
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture("/title/mojang.png"));
    var2.startDrawingQuads();
    var2.setColorOpaque_I(16777215);
    var2.addVertexWithUV(0.0D, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D);
    var2.addVertexWithUV((double) mc.displayWidth, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D);
    var2.addVertexWithUV((double) mc.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
    var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    var2.draw();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    var2.setColorOpaque_I(16777215);
    short var3 = 256;
    short var4 = 256;
    mc.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3,
            var4);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    Display.swapBuffers();
}