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:main.java.com.example.emitters.ExampleEmitter.java

License:Open Source License

@Override
public void Render(float interpolation) {
    //Sort the Particles by their Z location
    Collections.sort(particles, new Comparator<Particle>() {
        @Override//ww w .j av  a 2s  . com
        public int compare(Particle p1, Particle p2) {
            return Float.compare(p1.getModelPos().z, p2.getModelPos().z);
        }
    });

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

    super.Render(interpolation);

    List<Particle> dead = new ArrayList();

    particles.stream().forEach((p) -> {
        p.Render(interpolation);
        if (!p.isAlive()) {
            dead.add(p);
        }
    });

    particles.removeAll(dead);

    GL11.glDisable(GL11.GL_BLEND);
}

From source file:main.java.com.example.emitters.ExampleParticle.java

License:Open Source License

@Override
public void Render(float interpolation) {
    GL11.glEnable(GL11.GL_BLEND);/*  w  w w .jav a2 s .  co m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    super.Render(interpolation);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:makeo.gadomancy.client.gui.InfusionClawGui.java

License:LGPL

@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
    ItemStack cursorStack = container.playerInv.getItemStack();
    if (((TileInfusionClaw) container.clawInv).isRunning() || (cursorStack != null && cursorStack.stackSize > 0
            && !container.clawInv.isItemValidForSlot(0, cursorStack))) {
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

        GL11.glEnable(GL11.GL_BLEND);/*from w ww.  j  ava  2s .  c o  m*/
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1, 1, 1, 0.5f);

        this.mc.renderEngine.bindTexture(BACKGROUND);
        float t = this.zLevel;
        this.zLevel = 200.0F;
        GL11.glEnable(3042);
        drawTexturedModalRect(80, 32, 240, 0, 16, 16);
        GL11.glDisable(3042);
        this.zLevel = t;

        GL11.glPopAttrib();
    }
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileStickyJar.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
        TileStickyJar stickyJar = (TileStickyJar) tile;

        TileJarFillable parent = stickyJar.getParent();
        World world = tile.getWorldObj();
        Block block = stickyJar.getParentBlock();

        GL11.glPushMatrix();/*from ww  w . ja v a2  s  .com*/

        GL11.glTranslated(x, y, z);
        rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing));

        //TESR
        TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent);
        if (renderer != null) {
            stickyJar.syncToParent();

            renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks);

            stickyJar.syncFromParent();
        }

        //ISimpleBlockHandler
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

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

        bindTexture(TextureMap.locationBlocksTexture);

        RENDER_BLOCKS.blockAccess = world;

        Tessellator tess = Tessellator.instance;
        tess.startDrawingQuads();

        tess.setNormal(0, -stickyJar.placedOn.offsetY,
                -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX));

        tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord);

        RENDER_BLOCKS.renderBlockByRenderType(block, tile.xCoord, tile.yCoord, tile.zCoord);

        tess.setTranslation(0, 0, 0);
        tess.draw();

        GL11.glPopAttrib();
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }
}

From source file:mal.core.gui.GuiTexturedButton.java

License:Open Source License

/**
  * Draws this button to the screen./*from   w w w.  j a v a2s.co m*/
  */
@Override
public void drawButton(Minecraft mc, int mx, int my) {
    if (this.visible) {
        FontRenderer fontrenderer = mc.fontRenderer;
        mc.getTextureManager().bindTexture(new ResourceLocation(modname, imageLocation));
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.field_146123_n = mx >= this.xPosition && my >= this.yPosition && mx < this.xPosition + this.width
                && my < this.yPosition + this.height;
        int k = this.getHoverState(this.field_146123_n);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        this.drawTexturedModalRect(this.xPosition * 2, this.yPosition * 2, u * 2, v * 2 + (height) * 2 * state,
                this.width * 2 + 2, this.height * 2 + 1);
        GL11.glScalef(2.0f, 2.0f, 2.0f);
        //this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
        this.mouseDragged(mc, mx, my);
        int l = 14737632;

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

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

From source file:matteroverdrive.client.render.entity.EntityRendererPhaserFire.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *///from   w  ww .  j  a v  a 2 s.  c o  m
public void doRender(PlasmaBolt plasmaBolt, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    this.bindEntityTexture(plasmaBolt);
    RenderUtils.disableLightmap();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    RenderUtils.applyColorWithMultipy(plasmaBolt.getColor(),
            MOEasing.Quad.easeOut(plasmaBolt.getLife(), 0, 1, 0.7f));
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(plasmaBolt.prevRotationYaw
            + (plasmaBolt.rotationYaw - plasmaBolt.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(plasmaBolt.prevRotationPitch
            + (plasmaBolt.rotationPitch - plasmaBolt.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    float renderSize = plasmaBolt.getRenderSize();
    double length = 6
            * Vec3.createVectorHelper(plasmaBolt.motionX, plasmaBolt.motionY, plasmaBolt.motionZ).lengthVector()
            + 10;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(1, -renderSize, -renderSize, (double) f6, (double) f8);
    tessellator.addVertexWithUV(1, -renderSize, renderSize, (double) f7, (double) f8);
    tessellator.addVertexWithUV(1, renderSize, renderSize, (double) f7, (double) f9);
    tessellator.addVertexWithUV(1, renderSize, -renderSize, (double) f6, (double) f9);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(length - 1, -renderSize, renderSize, (double) f7, (double) f8);
    tessellator.addVertexWithUV(length - 1, renderSize, renderSize, (double) f7, (double) f9);
    tessellator.addVertexWithUV(length - 1, renderSize, -renderSize, (double) f6, (double) f9);
    tessellator.addVertexWithUV(length - 1, -renderSize, -renderSize, (double) f6, (double) f8);
    tessellator.draw();

    for (int i = 0; i < 2; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0, -renderSize, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(length, -renderSize, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(length, renderSize, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(0, renderSize, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    RenderUtils.enableLightmap();
}

From source file:matteroverdrive.client.render.entity.EntityRendererRougeAndroid.java

License:Open Source License

@Override
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    if (hologram) {
        GL11.glPushMatrix();/*from   w ww  .  j a v a2s  . co  m*/
        GL11.glDisable(GL11.GL_CULL_FACE);
        this.mainModel.onGround = this.renderSwingProgress(p_76986_1_, p_76986_9_);

        if (this.renderPassModel != null) {
            this.renderPassModel.onGround = this.mainModel.onGround;
        }

        this.mainModel.isRiding = p_76986_1_.isRiding();

        if (this.renderPassModel != null) {
            this.renderPassModel.isRiding = this.mainModel.isRiding;
        }

        this.mainModel.isChild = p_76986_1_.isChild();

        if (this.renderPassModel != null) {
            this.renderPassModel.isChild = this.mainModel.isChild;
        }

        this.renderLivingAt(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);

        try {
            float f2 = 0;
            float f3 = 0;
            float f4;

            f4 = this.handleRotationFloat(p_76986_1_, p_76986_9_);
            this.rotateCorpse(p_76986_1_, f4, f2, p_76986_9_);
            float f5 = 0.0625F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            GL11.glScalef(-1.0F, -1.0F, 1.0F);
            this.preRenderCallback(p_76986_1_, p_76986_9_);
            GL11.glTranslatef(0.0F, -24.0F * f5 - 0.0078125F, 0.0F);
            float f6 = p_76986_1_.prevLimbSwingAmount
                    + (p_76986_1_.limbSwingAmount - p_76986_1_.prevLimbSwingAmount) * p_76986_9_;
            float f7 = p_76986_1_.limbSwing - p_76986_1_.limbSwingAmount * (1.0F - p_76986_9_);

            if (p_76986_1_.isChild()) {
                f7 *= 3.0F;
            }

            if (f6 > 1.0F) {
                f6 = 1.0F;
            }

            GL11.glEnable(GL11.GL_ALPHA_TEST);
            this.mainModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
            this.renderModel(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);
            int j;
            float f8;
            float f9;
            float f10;

            for (int i = 0; i < 4; ++i) {
                j = this.shouldRenderPass(p_76986_1_, i, p_76986_9_);

                if (j > 0) {
                    this.renderPassModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
                    this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    if ((j & 240) == 16) {
                        this.func_82408_c(p_76986_1_, i, p_76986_9_);
                        this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch,
                                f5);
                    }

                    if ((j & 15) == 15) {
                        f8 = (float) p_76986_1_.ticksExisted + p_76986_9_;
                        //this.bindTexture(RES_ITEM_GLINT);
                        GL11.glEnable(GL11.GL_BLEND);
                        f9 = 0.5F;
                        GL11.glColor4f(f9, f9, f9, 1.0F);
                        GL11.glDepthFunc(GL11.GL_EQUAL);
                        GL11.glDepthMask(false);

                        for (int k = 0; k < 2; ++k) {
                            GL11.glDisable(GL11.GL_LIGHTING);
                            f10 = 0.76F;
                            GL11.glColor4f(0.5F * f10, 0.25F * f10, 0.8F * f10, 1.0F);
                            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
                            GL11.glMatrixMode(GL11.GL_TEXTURE);
                            GL11.glLoadIdentity();
                            float f11 = f8 * (0.001F + (float) k * 0.003F) * 20.0F;
                            float f12 = 0.33333334F;
                            GL11.glScalef(f12, f12, f12);
                            GL11.glRotatef(30.0F - (float) k * 60.0F, 0.0F, 0.0F, 1.0F);
                            GL11.glTranslatef(0.0F, f11, 0.0F);
                            GL11.glMatrixMode(GL11.GL_MODELVIEW);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }

                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                        GL11.glMatrixMode(GL11.GL_TEXTURE);
                        GL11.glDepthMask(true);
                        GL11.glLoadIdentity();
                        GL11.glMatrixMode(GL11.GL_MODELVIEW);
                        GL11.glEnable(GL11.GL_LIGHTING);
                        GL11.glDisable(GL11.GL_BLEND);
                        GL11.glDepthFunc(GL11.GL_LEQUAL);
                    }

                    GL11.glDisable(GL11.GL_BLEND);
                    GL11.glEnable(GL11.GL_ALPHA_TEST);
                }
            }

            GL11.glDepthMask(true);
            this.renderEquippedItems(p_76986_1_, p_76986_9_);
            float f14 = p_76986_1_.getBrightness(p_76986_9_);
            j = this.getColorMultiplier(p_76986_1_, f14, p_76986_9_);
            OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

            if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                GL11.glDisable(GL11.GL_ALPHA_TEST);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                GL11.glDepthFunc(GL11.GL_EQUAL);

                if (p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
                    GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
                    this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    for (int l = 0; l < 4; ++l) {
                        if (this.inheritRenderPass(p_76986_1_, l, p_76986_9_) >= 0) {
                            GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }
                    }
                }

                if ((j >> 24 & 255) > 0) {
                    f8 = (float) (j >> 16 & 255) / 255.0F;
                    f9 = (float) (j >> 8 & 255) / 255.0F;
                    float f15 = (float) (j & 255) / 255.0F;
                    f10 = (float) (j >> 24 & 255) / 255.0F;
                    GL11.glColor4f(f8, f9, f15, f10);
                    this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    for (int i1 = 0; i1 < 4; ++i1) {
                        if (this.inheritRenderPass(p_76986_1_, i1, p_76986_9_) >= 0) {
                            GL11.glColor4f(f8, f9, f15, f10);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }
                    }
                }

                GL11.glDepthFunc(GL11.GL_LEQUAL);
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_ALPHA_TEST);
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }

            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        } catch (Exception exception) {

        }

        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
        this.passSpecialRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);
    } else {
        super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }
}

From source file:matteroverdrive.gui.element.ElementSlot.java

License:Open Source License

public void drawSlotIcon(HoloIcon icon, int x, int y) {
    if (icon != null && canDrawIcon(icon)) {
        GL11.glEnable(GL11.GL_BLEND);/*from  w  w w . ja  va  2s  .c o  m*/
        ApplyColor();
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        ClientProxy.holoIcons.bindSheet();
        ClientProxy.holoIcons.renderIcon(icon, x, y);
        GL11.glDisable(GL11.GL_BLEND);
        ResetColor();
    }
}

From source file:matteroverdrive.gui.element.MOElementTextField.java

License:Open Source License

@Override
public void drawForeground(int mouseX, int mouseY) {

    boolean enableStencil = this.enableStencil;
    int bit = -1;
    l: if (enableStencil) {
        bit = MinecraftForgeClient.reserveStencilBit();
        if (bit == -1) {
            enableStencil = false;// w  w w.j  a  v a  2s  .com
            break l;
        }
        GL11.glEnable(GL11.GL_STENCIL_TEST);
        drawStencil(posX + 1, posY + 1, posX + sizeX - 1, posY + sizeY - 1, 1 << bit);
    }

    FontRenderer font = getFontRenderer();
    char[] text = this.text;
    int startX = posX + 1 - (multiline ? renderStartX : 0), endX = sizeX - 1;
    int startY = posY + 1 - renderStartY, endY = startY + font.FONT_HEIGHT;
    int drawY = renderStartY + Math.max(0, (sizeY - 2) / font.FONT_HEIGHT) * font.FONT_HEIGHT;
    if (enableStencil) {
        if (sizeY - (drawY - renderStartY) > 2) {
            drawY += font.FONT_HEIGHT;
        }
    }
    int drawX = endX + (multiline ? renderStartX : 0);
    for (int i = multiline ? 0 : renderStartX, width = 0, height = 0; i <= textLength; ++i) {
        boolean end = i == textLength, draw = height >= renderStartY && width < drawX && height < drawY;
        int charW = 2;
        char c = 0;
        if (!end) {
            c = text[i];
            if (draw) {
                charW = multiline && c == '\n' ? 2 : font.getCharWidth(c);
            }
            int tWidth = width + charW;
            if (multiline) {
                if (!enableStencil) {
                    draw &= width >= renderStartX;
                }
                draw &= tWidth > renderStartX;
            }
            l: if (!enableStencil && tWidth > endX) {
                draw = false;
                if (multiline) {
                    if (c == '\n') {
                        break l;
                    }
                    continue;
                }
                break;
            }
        }

        boolean drawCaret = draw && i == caret && (caretCounter &= 31) < 16 && isFocused();
        if (drawCaret) {
            int caretEnd = width + 2;
            if (caretInsert) {
                caretEnd = width + charW;
            }
            drawModalRect(startX + width, startY - 1 + height, startX + caretEnd, endY + height,
                    (0xFF000000 & defaultCaretColor) | (~defaultCaretColor & 0xFFFFFF));
        }

        if (draw && !end) {
            boolean selected = i >= selectionStart & i < selectionEnd;
            if (selected) {
                drawModalRect(startX + width, startY + height, startX + width + charW, endY + height,
                        selectedLineColor);
            }
            if (c != '\n') {
                font.drawString(String.valueOf(c), startX + width, startY + height,
                        selected ? selectedTextColor : textColor);
            }
        }

        if (drawCaret) {
            int caretEnd = width + 2;
            if (caretInsert) {
                caretEnd = width + charW;
            }

            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ZERO);
            gui.drawSizedRect(startX + width, startY - 1 + height, startX + caretEnd, endY + height, -1);
            GL11.glDisable(GL11.GL_BLEND);
        }

        if (c == '\n') {
            height += font.FONT_HEIGHT;
            charW = width = 0;
            if (height > drawY) {
                break;
            }
        }

        width += charW;
        if (!multiline && width > endX) {
            break;
        }
    }

    if (enableStencil) {
        GL11.glDisable(GL11.GL_STENCIL_TEST);
        MinecraftForgeClient.releaseStencilBit(bit);
    }

    if (holoIcon != null) {
        if (color != null)
            RenderUtils.applyColor(color);

        float heightScale = (float) Math.min(holoIcon.getOriginalHeight(), sizeY)
                / (float) holoIcon.getOriginalHeight();
        ClientProxy.holoIcons.renderIcon(holoIcon, posX - holoIcon.getOriginalWidth() - 2, posY,
                (int) (holoIcon.getOriginalWidth() * heightScale),
                (int) (holoIcon.getOriginalHeight() * heightScale));
    }
}

From source file:matteroverdrive.gui.element.starmap.ElementAbstractStarMapEntry.java

License:Open Source License

@Override
public void drawBackground(int mouseX, int mouseY, float gameTicks) {
    GL11.glEnable(GL11.GL_BLEND);//w  w w  .  j a  v  a  2s  .co  m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    float multiply = getMultiply(spaceBody);

    RenderUtils.applyColorWithMultipy(getSpaceBodyColor(spaceBody), multiply);
    if (isSelected(spaceBody)) {
        getBG(spaceBody).render(posX, posY, sizeX - 64, sizeY);
        if (canView(spaceBody, Minecraft.getMinecraft().thePlayer)) {
            this.BG_MIDDLE_NORMAL.render(posX + sizeX - 64, posY, 32, sizeY);
        }
        if (canTravelTo(spaceBody, Minecraft.getMinecraft().thePlayer))
            this.BG_FLIPPED.render(posX + sizeX - 32, posY, 32, sizeY);
        RenderUtils.applyColorWithMultipy(getSpaceBodyColor(spaceBody), multiply * 0.75f);

    } else {
        if (intersectsWith(mouseX, mouseY)) {
            getBG(spaceBody).render(posX, posY, sizeX - 64, sizeY);
        } else {
            getBG(spaceBody).render(posX, posY, sizeX - 64, sizeY);
        }
    }
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
}