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:buildcraft.core.lib.gui.GuiBuildCraft.java

License:Minecraft Mod Public

/**
 * Draws the screen and all the components in it.
 *//* ww  w  .j  a v a 2  s .c  o m*/
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
    super.drawScreen(mouseX, mouseY, par3);
    int left = this.guiLeft;
    int top = this.guiTop;

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glTranslatef(left, top, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.disableStandardItemLighting();

    InventoryPlayer playerInv = this.mc.thePlayer.inventory;

    if (playerInv.getItemStack() == null) {
        drawToolTips(container.getWidgets(), mouseX - left, mouseY - top, left, top);
        drawToolTips(buttonList, mouseX, mouseY, 0, 0);
        drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY, 0, 0);
    }

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:buildcraft.core.lib.gui.GuiBuildCraft.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(texture);//from   w  w w.j  a v  a  2  s.c  o m
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

    int mX = mouseX - guiLeft;
    int mY = mouseY - guiTop;

    drawWidgets(mX, mY);
}

From source file:buildcraft.core.lib.render.FluidRenderer.java

License:Minecraft Mod Public

public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) {
    if (fluidStack == null) {
        return null;
    }/*from   w ww .  jav a2s  . c o  m*/
    Fluid fluid = fluidStack.getFluid();
    if (fluid == null) {
        return null;
    }
    Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
    int[] diplayLists = cache.get(fluid);
    if (diplayLists != null) {
        return diplayLists;
    }

    diplayLists = new int[DISPLAY_STAGES];

    if (fluid.getBlock() != null) {
        liquidBlock.baseBlock = fluid.getBlock();
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    } else {
        liquidBlock.baseBlock = Blocks.water;
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    }

    cache.put(fluid, diplayLists);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int s = 0; s < DISPLAY_STAGES; ++s) {
        diplayLists[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/);

        liquidBlock.minX = 0.01f;
        liquidBlock.minY = 0;
        liquidBlock.minZ = 0.01f;

        liquidBlock.maxX = 0.99f;
        liquidBlock.maxY = Math.max(s, 1) / (float) DISPLAY_STAGES;
        liquidBlock.maxZ = 0.99f;

        RenderEntityBlock.INSTANCE.renderBlock(liquidBlock);

        GL11.glEndList();
    }

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    return diplayLists;
}

From source file:buildcraft.core.lib.render.RenderUtils.java

License:Minecraft Mod Public

public static void setGLColorFromInt(int color) {
    float red = (color >> 16 & 255) / 255.0F;
    float green = (color >> 8 & 255) / 255.0F;
    float blue = (color & 255) / 255.0F;
    GL11.glColor4f(red, green, blue, 1.0F);
}

From source file:buildcraft.core.render.BlockHighlightHandler.java

License:Minecraft Mod Public

@SideOnly(Side.CLIENT)
@SubscribeEvent/*from w w w .  j a  v a  2  s.com*/
public void handleBlockHighlight(DrawBlockHighlightEvent e) {
    if (e.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
        int x = e.target.blockX;
        int y = e.target.blockY;
        int z = e.target.blockZ;
        Block block = e.player.worldObj.getBlock(x, y, z);
        if (block instanceof ICustomHighlight) {
            AxisAlignedBB[] aabbs = ((ICustomHighlight) block).getBoxes(e.player.worldObj, x, y, z, e.player);
            Vec3 pos = e.player.getPosition(e.partialTicks);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
            GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
            GL11.glLineWidth(2.0F);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glDepthMask(false);
            double exp = ((ICustomHighlight) block).getExpansion();
            for (AxisAlignedBB aabb : aabbs) {
                RenderGlobal.drawOutlinedBoundingBox(aabb.copy().expand(exp, exp, exp).offset(x, y, z)
                        .offset(-pos.xCoord, -pos.yCoord, -pos.zCoord), -1);
            }
            GL11.glDepthMask(true);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_BLEND);
            e.setCanceled(true);
        }
    }
}

From source file:buildcraft.core.render.FluidRenderer.java

License:Minecraft Mod Public

public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) {
    if (fluidStack == null) {
        return null;
    }//from w w w . j a  v  a 2  s  .c o m
    Fluid fluid = fluidStack.getFluid();
    if (fluid == null) {
        return null;
    }
    Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
    int[] diplayLists = cache.get(fluid);
    if (diplayLists != null) {
        return diplayLists;
    }

    diplayLists = new int[DISPLAY_STAGES];

    if (fluid.getBlock() != null) {
        liquidBlock.baseBlock = fluid.getBlock();
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    } else {
        liquidBlock.baseBlock = Blocks.water;
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    }

    cache.put(fluid, diplayLists);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int s = 0; s < DISPLAY_STAGES; ++s) {
        diplayLists[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/);

        liquidBlock.minX = 0.01f;
        liquidBlock.minY = 0;
        liquidBlock.minZ = 0.01f;

        liquidBlock.maxX = 0.99f;
        liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES;
        liquidBlock.maxZ = 0.99f;

        RenderEntityBlock.INSTANCE.renderBlock(liquidBlock, world, 0, 0, 0, false, true);

        GL11.glEndList();
    }

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    return diplayLists;
}

From source file:buildcraft.core.render.LiquidRenderer.java

License:Minecraft Mod Public

public static int[] getLiquidDisplayLists(LiquidStack liquid, World world, boolean flowing) {
    if (liquid == null) {
        return null;
    }//from w  ww.ja va2 s .co  m
    liquid = liquid.canonical();
    if (liquid == null) {
        throw new LiquidCanonException(liquid);
    }
    Map<LiquidStack, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
    int[] diplayLists = cache.get(liquid);
    if (diplayLists != null) {
        return diplayLists;
    }

    diplayLists = new int[DISPLAY_STAGES];

    if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null) {
        liquidBlock.baseBlock = Block.blocksList[liquid.itemID];
        if (!flowing) {
            liquidBlock.texture = getLiquidTexture(liquid);
        }
    } else if (Item.itemsList[liquid.itemID] != null) {
        liquidBlock.baseBlock = Block.waterStill;
        liquidBlock.texture = getLiquidTexture(liquid);
    } else {
        return null;
    }

    cache.put(liquid, diplayLists);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    ItemStack stack = liquid.asItemStack();
    int color = stack.getItem().getColorFromItemStack(stack, 0);
    float c1 = (float) (color >> 16 & 255) / 255.0F;
    float c2 = (float) (color >> 8 & 255) / 255.0F;
    float c3 = (float) (color & 255) / 255.0F;
    GL11.glColor4f(c1, c2, c3, 1);
    for (int s = 0; s < DISPLAY_STAGES; ++s) {
        diplayLists[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/);

        liquidBlock.minX = 0.01f;
        liquidBlock.minY = 0;
        liquidBlock.minZ = 0.01f;

        liquidBlock.maxX = 0.99f;
        liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES;
        liquidBlock.maxZ = 0.99f;

        RenderEntityBlock.renderBlock(liquidBlock, world, 0, 0, 0, false, true);

        GL11.glEndList();
    }

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    return diplayLists;
}

From source file:buildcraft.energy.gui.GuiCombustionEngine.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/combustion_engine_gui.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(i);/* w w w  .j a  v a  2 s. c  o m*/
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

    TileEngine engine = (TileEngine) tile;
    EngineIron engineIron = ((EngineIron) engine.engine);

    if (engine.getScaledBurnTime(58) > 0) {
        displayGauge(j, k, 19, 104, engine.getScaledBurnTime(58), engineIron.getFuelId(),
                engineIron.getFuelMeta());
    }

    if (engineIron.getScaledCoolant(58) > 0) {
        displayGauge(j, k, 19, 122, engineIron.getScaledCoolant(58), engineIron.getCoolantId(),
                engineIron.getCoolantMeta());
    }
}

From source file:buildcraft.energy.gui.GuiSteamEngine.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    int i = mc.renderEngine.getTexture(DefaultProps.TEXTURE_PATH_GUI + "/steam_engine_gui.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(i);/*w  ww.  j av  a  2  s.c om*/
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

    TileEngine engine = (TileEngine) tile;
    if (engine.getScaledBurnTime(12) > 0) {
        int l = engine.getScaledBurnTime(12);

        drawTexturedModalRect(j + 80, (k + 24 + 12) - l, 176, 12 - l, 14, l + 2);
    }
}

From source file:buildcraft.energy.gui.GuiStoneEngine.java

License:Minecraft Mod Public

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(TEXTURE);
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    drawTexturedModalRect(j, k, 0, 0, xSize, ySize);

    TileEngine engine = (TileEngine) tile;
    if (engine.getScaledBurnTime(12) > 0) {
        int l = engine.getScaledBurnTime(12);

        drawTexturedModalRect(j + 80, (k + 24 + 12) - l, 176, 12 - l, 14, l + 2);
    }// w  ww. j av a2s .  c om
}