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:de.sanandrew.mods.claysoldiers.client.particle.ParticleRenderDispatcher.java

License:Creative Commons License

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

    GL11.glDepthMask(false);/*from  ww  w  .jav a  2 s.com*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    ParticleNexusFX.dispatchQueuedRenders(tessellator);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:de.sanandrew.mods.enderstuffp.client.gui.GuiButtonBiomeChanger.java

License:Creative Commons License

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
    if (this.visible) {
        FontRenderer fontrenderer = mc.fontRenderer;
        mc.getTextureManager().bindTexture(EnumTextures.GUI_BUTTONS.getResource());
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
                && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
        int hoverState = this.getHoverState(this.field_146123_n);

        GL11.glEnable(GL11.GL_BLEND);/*from   w w w  . j  a v  a 2 s  .c om*/
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 78 + hoverState * 14, this.width / 2,
                this.height);
        this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2,
                78 + hoverState * 14, this.width / 2, this.height);

        this.mouseDragged(mc, mouseX, mouseY);
        int l = 0xE0E0E0;

        if (packedFGColour != 0) {
            l = packedFGColour;
        } else if (!this.enabled) {
            l = 0xA0A0A0;
        } else if (this.field_146123_n) {
            l = 0xFFFFA0;
        }

        this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2,
                this.yPosition + (this.height - 8) / 2, l);
    }
}

From source file:de.sanandrew.mods.turretmod.client.render.entity.RenderTurret.java

License:Creative Commons License

private int renderGlowMap(EntityTurretBase turret, int pass) {
    if (pass == 0) {
        this.setRenderPassModel(this.glowModel);
        this.bindTexture(turret.getGlowTexture());

        GL11.glEnable(GL11.GL_BLEND);//from   w  w w  .j  a v  a 2s  .  co m
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

        int bright = 0xF0;
        int brightX = bright % 65536;
        int brightY = bright / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDepthMask(false);

        return 1;
    } else if (pass == 1) {
        this.setRenderPassModel(this.mainModel);
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_BLEND);
    }

    return -1;
}

From source file:disconsented.anssrpg.gui.PerkGUI.java

License:Open Source License

/**
 * //from w  w w .  j a  v a 2  s  .co m
 * @param x
 * @param y
 * @param width
 * @param height
 * @param color
 * @param mode
 */
void drawTriangle(int x, int y, int width, int height, int color, int mode) {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Tessellator tes = Tessellator.instance;
    tes.startDrawing(GL11.GL_TRIANGLES);
    tes.setColorOpaque_I(color);
    switch (mode) {
    case 1:
        tes.addVertex(x, y, 0); //top left
        tes.addVertex(x, y + height, 0); //Bottom left
        tes.addVertex(x + width, y, 0); //top right  
        break;
    case 2:
        break;
    case 3:
        tes.addVertex(x + width, y, 0); //top right
        tes.addVertex(x, y + height, 0); //Bottom left
        tes.addVertex(x + width, y + height, 0); //bottom right
        break;
    case 4:
        break;
    }
    tes.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);

}

From source file:dk.philiphansen.craftech.inventory.GuiBlastFurnace.java

License:Open Source License

private void renderItems() {
    RenderItem renderItem = new RenderItem();
    renderItem.renderWithColor = false;//from   ww w  . ja v  a  2  s  .  c  o m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(0.6f, 0.6f, 0.6f, 0.7f);

    GL11.glPushMatrix();

    renderItem.renderItemIntoGUI(fontRendererObj, mc.renderEngine, new ItemStack(ModItems.itemIronDust), 62,
            17);
    renderItem.renderItemIntoGUI(fontRendererObj, mc.renderEngine, new ItemStack(ModItems.itemLimestoneDust),
            80, 17);
    renderItem.renderItemIntoGUI(fontRendererObj, mc.renderEngine, new ItemStack(ModItems.itemCokeDust), 98,
            17);

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

From source file:dk.philiphansen.craftech.inventory.GuiTechTable.java

License:Open Source License

/**
 * Render the items correlating to the crafting recipe, in the crafting matrix.
 *///from w  w  w.  ja  v  a2  s.  c om
private void renderItems() {
    if (techTable.getStackInSlot(10) != null) {
        ItemStack recipeItem = techTable.getStackInSlot(10);
        TechTableRecipe recipe = TechTableRecipes.getInstance().findMatchingRecipe(recipeItem);
        ItemStack[] input = recipe.getRecipeInput();

        RenderItem renderer = new RenderItem();
        renderer.renderWithColor = false;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4d(0.6f, 0.6f, 0.6f, 0.7f);

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                ItemStack itemStack = input[i * 3 + j];

                GL11.glPushMatrix();

                if (itemStack != null) {
                    FontRenderer fontRenderer = itemStack.getItem().getFontRenderer(itemStack);

                    renderer.renderItemIntoGUI(fontRenderer, mc.renderEngine, itemStack, 50 + (18 * j),
                            17 + (i * 18));
                }

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

From source file:dracocore.handbook.buttons.GuiButtonCategory.java

License:Creative Commons License

@Override
public void drawButton(Minecraft mc, int mx, int my) {
    boolean inside = mx >= xPosition && my >= yPosition && mx < xPosition + width && my < yPosition + height;
    float time = 5F;
    if (inside)//  w ww.j  a  va  2  s.  c  om
        ticksHovered = Math.min(time, ticksHovered + gui.timeDelta);
    else
        ticksHovered = Math.max(0F, ticksHovered - gui.timeDelta);

    ResourceLocation resource;
    if (category == null)
        resource = fallbackResource;
    else
        resource = category.getIcon();
    if (resource == null)
        resource = fallbackResource;

    mc.renderEngine.bindTexture(resource);
    float s = 1F / 48F;
    float defAlpha = 0.3F;
    float alpha = ticksHovered / time * (1F - defAlpha) + defAlpha;

    GL11.glPushMatrix();
    GL11.glColor4f(1F, 1F, 1F, alpha);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glScalef(0.5F, 0.5F, 0.5F);
    VazkiiRenderHelper.drawTexturedModalRect(xPosition * 2, yPosition * 2, zLevel * 2, 0, 0, 48, 48, s, s);
    GL11.glPopMatrix();

    if (inside)
        VazkiiRenderHelper.renderTooltipGreen(mx, my,
                Arrays.asList(StatCollector.translateToLocal(getTooltipText())));
}

From source file:dracocore.handbook.helpers.RenderHelper.java

License:Creative Commons License

public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
    final float var7 = ((par5 >> 24) & 255) / 255F;
    final float var8 = ((par5 >> 16) & 255) / 255F;
    final float var9 = ((par5 >> 8) & 255) / 255F;
    final float var10 = (par5 & 255) / 255F;
    final float var11 = ((par6 >> 24) & 255) / 255F;
    final float var12 = ((par6 >> 16) & 255) / 255F;
    final float var13 = ((par6 >> 8) & 255) / 255F;
    final float var14 = (par6 & 255) / 255F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);/* w w  w.j  av  a 2s. com*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    final Tessellator var15 = Tessellator.instance;
    var15.startDrawingQuads();
    var15.setColorRGBA_F(var8, var9, var10, var7);
    var15.addVertex(par3, par2, z);
    var15.addVertex(par1, par2, z);
    var15.setColorRGBA_F(var12, var13, var14, var11);
    var15.addVertex(par1, par4, z);
    var15.addVertex(par3, par4, z);
    var15.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:dracocore.handbook.pages.PageCraftingRecipe.java

License:Creative Commons License

@Override
@SideOnly(Side.CLIENT)//from   ww  w. j av a2 s. co m
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
    oreDictRecipe = shapelessRecipe = false;

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

    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(), 0, 0, gui.getWidth(), gui.getHeight());

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

    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)
            VazkiiRenderHelper.renderTooltip(mx, my,
                    Arrays.asList(StatCollector.translateToLocal("dracocoremisc.shapeless")));

        iconY += 20;
    }

    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)
            VazkiiRenderHelper.renderTooltip(mx, my,
                    Arrays.asList(StatCollector.translateToLocal("dracocoremisc.oredict")));
    }
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:dracocore.handbook.pages.PageLoreText.java

License:Creative Commons License

@Override
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    Minecraft.getMinecraft().renderEngine.bindTexture(paperOverlay);

    GL11.glEnable(GL11.GL_BLEND);//from  w w w  .  ja  v  a2s  .c o  m
    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(), 0, 0, gui.getWidth(), gui.getHeight());
    GL11.glDisable(GL11.GL_BLEND);
    super.renderScreen(gui, mx, my);
}