Example usage for org.lwjgl.opengl GL11 glBlendFunc

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

Introduction

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

Prototype

public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor) 

Source Link

Document

Specifies the weighting factors used by the blend equation, for both RGB and alpha functions and for all draw buffers.

Usage

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderAntiSpider.java

License:Apache License

protected int shouldRenderPass(EntityAntiSpider par1EntityAntiSpider, int par2, float par3) {
    if (par2 != 0)
        return -1;
    else {/*from   www  .ja  va2 s  .  c  om*/
        bindTexture(spiderEyesTextures);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

        if (par1EntityAntiSpider.isInvisible())
            GL11.glDepthMask(false);
        else
            GL11.glDepthMask(true);

        char c0 = 61680;
        int j = c0 % 65536;
        int k = c0 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        return 1;
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the dragon model. Called by renderModel.
 *//*w  w  w . j  a  va  2 s  .  c  o  m*/
protected void renderDragonModel(EntityDragonBoss par1EntityDragonBoss, float par2, float par3, float par4,
        float par5, float par6, float par7) {
    if (par1EntityDragonBoss.deathTicks > 0) {
        float f6 = par1EntityDragonBoss.deathTicks / 200.0F;
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glAlphaFunc(GL11.GL_GREATER, f6);
        bindTexture(field_110842_f);
        mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDepthFunc(GL11.GL_EQUAL);
    }

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

    if (par1EntityDragonBoss.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);
        mainModel.render(par1EntityDragonBoss, 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:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the animation for when an enderdragon dies
 *///from ww w .  j av  a  2s.  com
protected void renderDragonDying(EntityDragonBoss par1entitydragonboss, float par2) {
    super.renderEquippedItems(par1entitydragonboss, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1entitydragonboss.deathTicks > 0) {
        RenderHelper.disableStandardItemLighting();
        float f1 = (par1entitydragonboss.deathTicks + par2) / 200.0F;
        float f2 = 0.0F;

        if (f1 > 0.8F)
            f2 = (f1 - 0.8F) / 0.2F;

        Random random = new Random(432L);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, -1.0F, -2.0F);

        for (int i = 0; i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) {
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
            float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
            tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(16711935, 0);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.0D, f3, 1.0F * f4);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.draw();
        }

        GL11.glPopMatrix();
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glShadeModel(GL11.GL_FLAT);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        RenderHelper.enableStandardItemLighting();
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass.
 *//*from w w w . j ava  2 s. c  o m*/
protected int renderGlow(EntityDragonBoss par1entitydragonboss, int par2, float par3) {
    if (par2 == 1)
        GL11.glDepthFunc(GL11.GL_LEQUAL);

    if (par2 != 0)
        return -1;
    else {
        bindTexture(field_110845_h);
        float f1 = 1.0F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        char c0 = 61680;
        int j = c0 % 65536;
        int k = c0 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
        return 1;
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonMinion.java

License:Apache License

/**
 * Renders the dragon model. Called by renderModel.
 *///from   ww w .j  a  v a2 s  .  com
protected void renderDragonModel(EntityDragonMinion par1EntityDragonMinion, float par2, float par3, float par4,
        float par5, float par6, float par7) {
    bindEntityTexture(par1EntityDragonMinion);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7);
    GL11.glDisable(GL11.GL_BLEND);

    if (par1EntityDragonMinion.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);
        mainModel.render(par1EntityDragonMinion, 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:com.shinoow.abyssalcraft.client.render.entity.RenderDragonMinion.java

License:Apache License

/**
 * Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass.
 *///from w  w  w. jav  a2s.  com
protected int renderGlow(EntityDragonMinion par1EntityDragonMinion, int par2, float par3) {
    if (par2 == 1)
        GL11.glDepthFunc(GL11.GL_LEQUAL);

    if (par2 != 0)
        return -1;
    else {
        bindTexture(field_110845_h);
        float f1 = 1.0F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_EQUAL);
        char c0 = 61680;
        int j = c0 % 65536;
        int k = c0 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
        return 1;
    }
}

From source file:com.shinoow.abyssalcraft.common.items.armor.ItemDepthsArmor.java

License:Apache License

@Override
@SideOnly(Side.CLIENT)// w w w  .ja va  2s. c om
public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution,
        float partialTicks, boolean hasScreen, int mouseX, int mouseY) {
    final ResourceLocation coraliumBlur = new ResourceLocation("abyssalcraft:textures/misc/coraliumblur.png");

    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && stack != null
            && stack.getItem() == AbyssalCraft.Depthshelmet) {
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

        Tessellator t = Tessellator.instance;

        ScaledResolution scale = new ScaledResolution(Minecraft.getMinecraft(),
                Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
        int width = scale.getScaledWidth();
        int height = scale.getScaledHeight();

        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        Minecraft.getMinecraft().renderEngine.bindTexture(coraliumBlur);

        t.startDrawingQuads();
        t.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D);
        t.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D);
        t.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D);
        t.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D);
        t.draw();

        GL11.glPopAttrib();
    }
}

From source file:com.spawck.hs2.client.renderer.model.ModelSoul.java

License:GNU General Public License

@Override
public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) {
    GL11.glPushMatrix();/*www  .  j a  va 2s  .  c om*/
    GL11.glScalef(1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(0.0F, -0.5F, 0.0F);

    if (this.base != null) {
        this.base.render(par7);
    }

    GL11.glEnable(2977);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0.0F, 0.8F + par4, 0.0F);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    this.glass.render(par7);
    float var8 = 0.875F;
    GL11.glScalef(var8, var8, var8);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    this.glass.render(par7);
    GL11.glScalef(var8, var8, var8);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    this.cube.render(par7);
    GL11.glDepthFunc(514);
    GL11.glDisable(2896);
    GL11.glEnable(3042);
    GL11.glBlendFunc(768, 1);
    float var14 = 0.76F;
    GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F);
    GL11.glMatrixMode(5890);
    GL11.glPushMatrix();
    float var15 = 0.125F;
    GL11.glScalef(var15, var15, var15);
    float var16 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
    GL11.glTranslatef(var16, 0.0F, 0.0F);
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    this.cube.render(par7);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glScalef(var15, var15, var15);
    var16 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
    GL11.glTranslatef(-var16, 0.0F, 0.0F);
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
    this.cube.render(par7);
    GL11.glPopMatrix();
    GL11.glMatrixMode(5888);
    GL11.glDisable(3042);
    GL11.glEnable(2896);
    GL11.glDepthFunc(515);
    GL11.glPopMatrix();
}

From source file:com.sr2610.steampunkd.handbook.pages.PageCraftingRecipe.java

License:Creative Commons License

@Override
@SideOnly(Side.CLIENT)//ww  w . j  a v a  2  s  .  c om
public void renderRecipe(IGuiHandbookEntry gui, int mx, int my) {

    final FontRenderer fontRendererObj = ((GuiScreen) gui).mc.fontRendererObj;

    final boolean unicode = fontRendererObj.getUnicodeFlag();
    fontRendererObj.setUnicodeFlag(true);
    fontRendererObj.setUnicodeFlag(unicode);

    oreDictRecipe = shapelessRecipe = false;

    final IRecipe recipe = recipes.get(recipeAt);
    renderCraftingRecipe(gui, recipe);

    final TextureManager render = Minecraft.getMinecraft().renderEngine;
    render.bindTexture(craftingOverlay);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop() + 10, 0, 0, gui.getWidth(),
            gui.getHeight());

    int iconX = gui.getLeft() + 115;
    final int iconY = gui.getTop() + 12 + 10;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    if (shapelessRecipe) {
        ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);

        if ((mx >= iconX) && (my >= iconY) && (mx < (iconX + 16)) && (my < (iconY + 16)))
            TooltipHelper.renderTooltip(mx, my, Arrays.asList(I18n.format("steampunkd.handbook.shapeless")));

        iconX = gui.getLeft() + 95;
    }

    render.bindTexture(craftingOverlay);
    GL11.glEnable(GL11.GL_BLEND);

    if (oreDictRecipe) {
        ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);

        if ((mx >= iconX) && (my >= iconY) && (mx < (iconX + 16)) && (my < (iconY + 16)))
            TooltipHelper.renderTooltip(mx, my, Arrays.asList(I18n.format("steampunked.handbook.oredict")));
    }

    if (oreDictRecipe)
        ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:com.sr2610.steampunkd.handbook.pages.PageRecipe.java

License:Creative Commons License

@SideOnly(Side.CLIENT)
public void renderItem(IGuiHandbookEntry gui, int xPos, int yPos, ItemStack stack,
        boolean accountForContainer) {
    yPos += 10;/*w  ww  .  j  a v  a  2  s .  c  o m*/
    final RenderItem render = Minecraft.getMinecraft().getRenderItem();
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    render.renderItemAndEffectIntoGUI(stack, xPos, yPos);
    RenderHelper.disableStandardItemLighting();
    GL11.glPopMatrix();

    if ((relativeMouseX >= xPos) && (relativeMouseY >= yPos) && (relativeMouseX <= (xPos + 16))
            && (relativeMouseY <= (yPos + 16))) {
        tooltipStack = stack;

        final EntryData data = HandbookRecipeMappings.getDataForStack(tooltipStack);
        if ((data != null) && ((data.entry != gui.getEntry()) || (data.page != gui.getPageOn()))) {
            tooltipEntry = true;

            if (Mouse.isButtonDown(0)) {
                final GuiHandbookEntry newGui = new GuiHandbookEntry(data.entry, (GuiScreen) gui);
                newGui.page = data.page;
                Minecraft.getMinecraft().displayGuiScreen(newGui);
            }
        }

        if (accountForContainer) {
            final ItemStack containerStack = stack.getItem().getContainerItem(stack);
            if ((containerStack != null) && (containerStack.getItem() != null))
                tooltipContainerStack = containerStack;
        }
    }

    GL11.glDisable(GL11.GL_LIGHTING);
}