Example usage for org.lwjgl.opengl GL11 glColor4f

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

Introduction

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

Prototype

public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);

Source Link

Document

Float version of #glColor4b Color4b

Usage

From source file:com.professorvennie.machinerycraft.client.gui.buttons.GuiButtonBack.java

License:Creative Commons License

@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
    field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width
            && par3 < yPosition + height;
    int k = getHoverState(field_146123_n);

    par1Minecraft.renderEngine.bindTexture(GuiBook.texture);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9);

    List<String> tooltip = getTooltip();
    int tooltipY = (tooltip.size() - 1) * 10;
    if (k == 2)/*w  w w  .j  a  v  a  2  s. co m*/
        RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
}

From source file:com.professorvennie.machinerycraft.client.gui.buttons.GuiButtonPage.java

License:Creative Commons License

@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
    if (enabled) {
        field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width
                && par3 < yPosition + height;
        int k = getHoverState(field_146123_n);

        par1Minecraft.renderEngine.bindTexture(GuiBook.texture);
        GL11.glColor4f(1F, 1F, 1F, 1F);
        drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);

        if (k == 2)
            RenderHelper.renderTooltip(par2, par3, Arrays
                    .asList(StatCollector.translateToLocal(right ? "mc.book.nextPage" : "mc.book.prevPage")));
    }/*from www  . j  a v  a 2s  . co  m*/
}

From source file:com.professorvennie.machinerycraft.client.gui.GuiBag.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(1F, 1F, 1F, 1F);

    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

From source file:com.professorvennie.machinerycraft.client.gui.GuiBase.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(0F, 0.30F, 0.97F, 1F);

    Minecraft.getMinecraft().getTextureManager().bindTexture(elements);
    drawTexturedModalRect(guiLeft + 176, guiTop + 3, 0, 0, 28, 89);

    if (basicMachine != null) {
        GL11.glColor4f(0.97F, 0.00F, 0F, 1F);
        drawTexturedModalRect(guiLeft + 176, guiTop + 92, 0, 94, 28, 28);

        if (basicMachine.hasEjectorUpgrade) {
            GL11.glColor4f(0F, 1F, 1F, 1F);
            drawTexturedModalRect(guiLeft + 176, guiTop + 119, 0, 94, 28, 28);
        }//  w w  w . j  a va 2 s  .  co  m
    }

    GL11.glColor4f(1F, 1F, 1F, 1F);
    if (backGround != null) {
        Minecraft.getMinecraft().getTextureManager().bindTexture(backGround);
        drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    }
}

From source file:com.professorvennie.machinerycraft.client.gui.GuiBase.java

License:Creative Commons License

public void drawTiledTexture(int x, int y, IIcon icon, int width, int height) {
    int i = 0;/*from  w  w  w . j  av a2  s.  co  m*/
    int j = 0;

    int drawHeight = 0;
    int drawWidth = 0;

    for (i = 0; i < width; i += 16) {
        for (j = 0; j < height; j += 16) {
            drawWidth = (width - i) < 16 ? (width - i) : 16;
            drawHeight = (height - j) < 16 ? (height - j) : 16;
            drawScaledTexturedModelRectFromIcon(x + i, y + j, icon, drawWidth, drawHeight);
        }
    }
    GL11.glColor4f(1f, 1f, 1f, 1F);
}

From source file:com.professorvennie.machinerycraft.client.gui.GuiPlasticChest.java

License:Creative Commons License

@Override
public void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glColor4f(1F, 1F, 1F, 1F);

    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

From source file:com.professorvennie.machinerycraft.client.gui.pages.PageCraftingRecipe.java

License:Creative Commons License

@Override
@SideOnly(Side.CLIENT)/*from   ww w  . java  2  s . c om*/
public void renderRecipe(IGuiBookEntry 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)
            RenderHelper.renderTooltip(mx, my,
                    Arrays.asList(StatCollector.translateToLocal("mc.book.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)
            RenderHelper.renderTooltip(mx, my,
                    Arrays.asList(StatCollector.translateToLocal("mc.book.oredict")));
    }
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:com.professorvennie.machinerycraft.client.gui.pages.PageImage.java

License:Creative Commons License

@Override
@SideOnly(Side.CLIENT)//from   ww w . j a v a  2 s .  c  o  m
public void renderScreen(IGuiBookEntry gui, int mx, int my) {
    TextureManager render = Minecraft.getMinecraft().renderEngine;
    render.bindTexture(resource);

    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());
    GL11.glDisable(GL11.GL_BLEND);

    int width = gui.getWidth() - 30;
    int height = gui.getHeight();
    int x = gui.getLeft() + 16;
    int y = gui.getTop() + height - 40;
    PageText.renderText(x, y, width, height, getUnlocalizedName());
}

From source file:com.professorvennie.machinerycraft.client.renderer.tileentity.TileEntityRendererPlasticChest.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    if (tileEntity instanceof TileEntityPlasticChest) {
        TileEntityPlasticChest tileEntityPlasticChest = (TileEntityPlasticChest) tileEntity;
        ForgeDirection direction = null;

        if (tileEntityPlasticChest.getWorldObj() != null) {
            direction = tileEntityPlasticChest.getOrientation();
            //System.out.println(tileEntityPlasticChest.getOrientation());
        }/*from   ww w.  j av a2s  . c om*/
        this.bindTexture(texture);

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short angle = 0;

        if (direction != null) {
            if (direction == ForgeDirection.NORTH) {
                angle = 180;
            } else if (direction == ForgeDirection.SOUTH) {
                angle = 0;
            } else if (direction == ForgeDirection.WEST) {
                angle = 90;
            } else if (direction == ForgeDirection.EAST) {
                angle = -90;
            }
        }

        GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float adjustedLidAngle = tileEntityPlasticChest.prevLidAngle
                + (tileEntityPlasticChest.lidAngle - tileEntityPlasticChest.prevLidAngle) * tick;
        adjustedLidAngle = 1.0F - adjustedLidAngle;
        adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
        modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);
        modelChest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:com.professorvennie.machinerycraft.core.handlers.HudHandler.java

License:Creative Commons License

private void drawBookGUI(BookEntry entry, ScaledResolution res) {
    GL11.glEnable(GL11.GL_BLEND);/*  www  . j a  v a2s .  c om*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Minecraft mc = Minecraft.getMinecraft();
    int x = res.getScaledWidth() / 2 + 8;
    int y = res.getScaledHeight() / 2 - 4;

    int color = 0xFF5A28;

    String info = StatCollector.translateToLocal("mc.book.shiftToRead");
    int itemX = x - (mc.fontRenderer.getStringWidth(new ItemStack(ModItems.book).getDisplayName()) / 2);
    mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal(entry.getUnlocalizedName()), itemX,
            y + 6, color);
    mc.fontRenderer.drawStringWithShadow(info, x - (mc.fontRenderer.getStringWidth(info) / 2), y + 18, color);
    itemRender.renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.book), itemX - 20,
            y + 2);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glColor4f(1F, 1F, 1F, 1F);
}