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:processing.lwjgl.PLWJGL.java

License:Open Source License

public void alphaFunc(int func, float ref) {
    GL11.glAlphaFunc(func, ref);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void alphaFunc(int func, float ref) {
    GL11.glAlphaFunc(func, ref);
}

From source file:RediscoveredMod.RenderRedDragon.java

License:Open Source License

/**
 * Renders the dragon model. Called by renderModel.
 *///from   www.  j ava2s  . c  o  m
protected void renderDragonModel(EntityGoodDragon par1EntityGoodDragon, float par2, float par3, float par4,
        float par5, float par6, float par7) {
    if (par1EntityGoodDragon.deathTicks > 0) {
        float f6 = (float) par1EntityGoodDragon.deathTicks / 200.0F;
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glAlphaFunc(GL11.GL_GREATER, f6);
        this.bindTexture(field_110842_f);
        this.mainModel.render(par1EntityGoodDragon, par2, par3, par4, par5, par6, par7);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDepthFunc(GL11.GL_EQUAL);
    }

    this.bindEntityTexture(par1EntityGoodDragon);
    this.mainModel.render(par1EntityGoodDragon, par2, par3, par4, par5, par6, par7);

    if (par1EntityGoodDragon.hurtTime > 0) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F);
        this.mainModel.render(par1EntityGoodDragon, par2, par3, par4, par5, par6, par7);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
}

From source file:ru.ulmc.extender.render.particle.EntityLockFX.java

License:Open Source License

@Override
public void renderParticle(Tessellator tess, float partialTicks, float par3, float par4, float par5, float par6,
        float par7) {
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    GL11.glDepthMask(false);/*  w ww . j a  v  a 2s. c om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    tess.startDrawingQuads();
    tess.setBrightness(getBrightnessForRender(partialTicks));
    float scale = 0.2F * particleScale;
    float x = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
    float y = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
    float z = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
    float f14 = 1.0F;
    tess.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14,
            this.particleAlpha);
    tess.addVertexWithUV(x - par3 * scale - par6 * scale, y - par4 * scale, z - par5 * scale - par7 * scale,
            0.0, 0.0);
    tess.addVertexWithUV(x - par3 * scale + par6 * scale, y + par4 * scale, z - par5 * scale + par7 * scale,
            1.0, 0.0);
    tess.addVertexWithUV(x + par3 * scale + par6 * scale, y + par4 * scale, z + par5 * scale + par7 * scale,
            1.0, 1.0);
    tess.addVertexWithUV(x + par3 * scale - par6 * scale, y - par4 * scale, z + par5 * scale - par7 * scale,
            0.0, 1.0);
    tess.draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    //UltimateExtender.logger.info("render at:" + partialTicks);
}

From source file:ru.ulmc.extender.render.particle.EntityTestFX.java

License:Open Source License

@Override
public void renderParticle(Tessellator tess, float partialTicks, float par3, float par4, float par5, float par6,
        float par7) {
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);

    GL11.glDepthMask(false);//from ww  w .j av  a 2s .c om
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);

    tess.startDrawingQuads();
    tess.setBrightness(getBrightnessForRender(partialTicks));
    float scale = 0.2F * particleScale;
    float x = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
    float y = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
    float z = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
    float f14 = 1.0F;
    //tess.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
    tess.addVertexWithUV(x + par3 * scale + par6 * scale, y + par4 * scale, z + par5 * scale + par7 * scale,
            0.0, 0.0);
    tess.addVertexWithUV(x + par3 * scale - par6 * scale, y - par4 * scale, z + par5 * scale - par7 * scale,
            0.0, 1.0);
    tess.addVertexWithUV(x - par3 * scale - par6 * scale, y - par4 * scale, z - par5 * scale - par7 * scale,
            1.0, 1.0);
    tess.addVertexWithUV(x - par3 * scale + par6 * scale, y + par4 * scale, z - par5 * scale + par7 * scale,
            1.0, 0.0);
    tess.draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    //UltimateExtender.logger.info("render at:" + partialTicks);
}

From source file:runes.Runes.CustomEffectRenderer.java

License:Open Source License

/**
 * Renders all current particles. Args player, partialTickTime
 *///from  w  ww . j a va 2 s  .c o m
public void renderParticles(Entity par1Entity, float par2) {
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = par1Entity.lastTickPosX + (par1Entity.posX - par1Entity.lastTickPosX) * (double) par2;
    EntityFX.interpPosY = par1Entity.lastTickPosY + (par1Entity.posY - par1Entity.lastTickPosY) * (double) par2;
    EntityFX.interpPosZ = par1Entity.lastTickPosZ + (par1Entity.posZ - par1Entity.lastTickPosZ) * (double) par2;

    for (int i = 0; i < 3; ++i) {
        if (!this.fxLayers[i].isEmpty()) {
            switch (i) {
            case 0:
            default:
                this.renderer.bindTexture(particleTextures);
                break;
            case 1:
                this.renderer.bindTexture(TextureMap.locationBlocksTexture);
                break;
            case 2:
                this.renderer.bindTexture(TextureMap.locationItemsTexture);
            }

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
            Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();

            for (int j = 0; j < this.fxLayers[i].size(); ++j) {
                EntityFX entityfx = (EntityFX) this.fxLayers[i].get(j);
                if (entityfx == null)
                    continue;
                tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
                entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4);
            }

            tessellator.draw();
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        }
    }
}

From source file:src.graphics.common.Rendering.java

License:Open Source License

/**  A generalised interface for stuff that wants to be rendered-
  *//*from   ww  w. j a  va2  s  . c om*/
void initSettings() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL11.glEnable(GL11.GL_NORMALIZE); //  IF MISSING, COLOURS ARE TOO BRIGHT.
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);

    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE);
}

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

@Override
public void setAlphaFunc(AlphaFunc func, final float refValue) {
    switch (func) {
    case Greater:
        GL11.glAlphaFunc(GL11.GL_GREATER, refValue);
        break;/*from   ww  w. j av a2 s .  com*/
    case GreaterOrEqual:
        GL11.glAlphaFunc(GL11.GL_GEQUAL, refValue);
        break;
    case Equal:
        GL11.glAlphaFunc(GL11.GL_EQUAL, refValue);
        break;
    case Less:
        GL11.glAlphaFunc(GL11.GL_LESS, refValue);
        break;
    case LessOrEqual:
        GL11.glAlphaFunc(GL11.GL_LEQUAL, refValue);
        break;
    default:
        assert false;
    }
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glAlphaFunc(int a, float b) {
    GL11.glAlphaFunc(a, b);
}

From source file:vazkii.botania.client.render.entity.RenderSpark.java

License:Creative Commons License

@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
    EntitySpark spark = (EntitySpark) par1Entity;
    IIcon iicon = ItemSpark.worldIcon;//from www  .j  a va2s . c o m

    GL11.glPushMatrix();
    GL11.glTranslatef((float) par2, (float) par4, (float) par6);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.05F);

    int time = ClientTickHandler.ticksInGame;
    time += new Random(par1Entity.getEntityId()).nextInt();
    GL11.glColor4f(1F, 1F, 1F, 0.7F + 0.3F * (float) (Math.sin(time / 5.0) + 0.5) * 2);

    float scale = 0.75F + 0.1F * (float) Math.sin((double) time / 10);
    GL11.glScalef(scale, scale, scale);
    bindEntityTexture(par1Entity);
    Tessellator tessellator = Tessellator.instance;

    float r = 180.0F - renderManager.playerViewY;
    GL11.glRotatef(r, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(25F * (float) Math.sin((double) time / 15), 1F, 0F, 0F);
    func_77026_a(tessellator, iicon);
    int upgrade = spark.getUpgrade() - 1;
    if (upgrade >= 0 && upgrade < ItemSparkUpgrade.worldIcons.length) {
        GL11.glTranslatef(-0.02F + (float) Math.sin((double) time / 20) * 0.2F,
                0.24F + (float) Math.cos((double) time / 20) * 0.2F, 0.005F);
        GL11.glScalef(0.2F, 0.2F, 0.2F);
        func_77026_a(tessellator, ItemSparkUpgrade.worldIcons[upgrade]);
    }
    GL11.glRotatef(-r, 0.0F, 1.0F, 0.0F);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}