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.mrcrayfish.furniture.gui.GuiMicrowave.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(gui);
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    this.drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);

    int percent = tileEntityMicrowave.progress * 27 / 40;
    drawTexturedModalRect(l + 120, i1 + 26, 176, 0, percent, 5);

    if (tileEntityMicrowave.isCooking()) {
        button_start.displayString = "Stop";
    } else {// w w  w.j  a  va  2  s.  c  o  m
        button_start.displayString = "Start";
    }
}

From source file:com.mrcrayfish.furniture.gui.GuiOven.java

License:Open Source License

protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(gui);
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    this.drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
    int var7;

    var7 = this.OvenInventory.getCookProgressScaled(24);
    drawTexturedModalRect(l + 75, i1 + 20, 176, 14, var7 + 1, 16);
    drawTexturedModalRect(l + 66, (i1 + 40), 176, 0, 14, 14);
    drawTexturedModalRect(l + 81, (i1 + 40), 176, 0, 14, 14);
    drawTexturedModalRect(l + 96, (i1 + 40), 176, 0, 14, 14);
}

From source file:com.mrcrayfish.furniture.gui.GuiPresent.java

License:Open Source License

protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    if (present.getItem() == FurnitureItems.itemPresentRed) {
        this.mc.getTextureManager().bindTexture(gui);
    } else {/*from ww w.  j a v a  2  s . c  o  m*/
        this.mc.getTextureManager().bindTexture(gui2);
    }
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    this.drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
}

From source file:com.mrcrayfish.furniture.gui.GuiPrinter.java

License:Open Source License

protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(gui);
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    this.drawTexturedModalRect(l, i1 - 10, 0, 0, xSize, ySize + 21);
    int var7;

    if (this.printerInventory.isPrinting()) {
        var7 = this.printerInventory.getPrintTimeRemainingScaled(16);
        drawTexturedModalRect(l + 74, (i1 + 38) - var7, 179, 16 - var7, 3, var7);
    }//from   w w w . ja va2  s.  c  om
    if (this.printerInventory.getStackInSlot(0) != null && this.printerInventory.isPrinting()) {
        var7 = this.printerInventory.getPrintingProgressScaled(16);
        drawTexturedModalRect(l + 80, (i1 + 37) - var7, 176, 15 - var7, 3, var7 + 1);
    }
}

From source file:com.mrcrayfish.furniture.gui.GuiRecipeBook.java

License:Open Source License

@Override
public void drawScreen(int par1, int par2, float par3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int k = (this.width - this.bookWidth) / 2;

    this.mc.getTextureManager().bindTexture(page_1);
    this.drawTexturedModalRect(k - bookWidth / 2, 5, 0, 0, bookWidth, bookHeight);

    this.mc.getTextureManager().bindTexture(page_2);
    this.drawTexturedModalRect(k + bookWidth / 2, 5, 0, 0, bookWidth, bookHeight);

    if (pageNum == 0) {
        this.mc.getTextureManager().bindTexture(page_1);
        this.drawTexturedModalRect((this.width / 2) - (this.bookWidth / 2) - (93 / 2), 50, 146, 0, 93, 25);
        this.drawTexturedModalRect((this.width / 2) - (this.bookWidth / 2) - (66 / 2), 75, 146, 25, 66, 22);
    }//from  ww w  .  ja v a2 s .co  m

    super.drawScreen(par1, par2, par3);

    this.updatePage(par1, par2);

    long currentTime = System.currentTimeMillis();
    if (currentTime > previousTime) {
        previousTime = currentTime + 10;
        progress++;
        if (progress >= 160) {
            progress = 0;
        }
    }
}

From source file:com.mrcrayfish.furniture.gui.GuiRecipeBook.java

License:Open Source License

public void drawTag(int x, int y) {
    GL11.glPushMatrix();/*from  www  .j  av  a  2s  .  c o  m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_CULL_FACE);
    this.mc.getTextureManager().bindTexture(page_1);
    this.drawTexturedModalRect(x, y, 0, 200, 45, 18);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:com.mrcrayfish.furniture.gui.GuiWashingMachine.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(gui);
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    this.drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);

    if (tileEntityWashingMachine.isWashing()) {
        int superMode = tileEntityWashingMachine.superMode ? 20 : 50;
        int percent = (tileEntityWashingMachine.progress % superMode) * 73 / superMode;
        drawTexturedModalRect((l + 34), (i1 + 104) - percent, 176, 73 - percent, 16, percent);
    }/*from  w ww .ja  v a  2s .  c o m*/

    int percent = tileEntityWashingMachine.timeRemaining * 73 / 5000;
    int superMode = tileEntityWashingMachine.superMode ? 20 : 0;
    drawTexturedModalRect((l + 129), (i1 + 103) - percent, 192 + superMode, 0, 10, percent);

    drawTexturedModalRect((l + 129), (i1 + 30), 202, 0, 10, 73);

    if (tileEntityWashingMachine.isWashing()) {
        button_start.displayString = "Stop";
        drawColour(l + 37, i1 + 9, 11, 11, 49475);
    } else {
        button_start.displayString = "Start";
        drawColour(l + 37, i1 + 9, 11, 11, 16711680);
    }
}

From source file:com.mrcrayfish.furniture.render.tileentity.BlenderRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_,
        int p_180535_9_) {
    TileEntityBlender blender = (TileEntityBlender) tileEntity;
    ItemStack[] ingredients = blender.getIngredients();

    GL11.glPushMatrix();/*from   ww  w. ja v a  2s.  c om*/
    GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.2F, (float) posZ + 0.5F);
    GL11.glScalef(0.65F, 0.65F, 0.65F);
    entityFood.hoverStart = 0.0F;
    for (int i = 0; i < ingredients.length; i++) {
        if (ingredients[i] != null) {
            entityFood.setEntityItemStack(ingredients[i]);
            GL11.glRotatef(i * -90F, 0, 1, 0);
            GL11.glRotatef(blender.progress * 18F, 0, 1, 0);
            Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityFood, 0.0D, 0.2D, 0.0D,
                    0.0F, 0.0F);
        }
    }
    GL11.glPopMatrix();

    if (blender.isBlending() | blender.drinkCount > 0) {
        Tessellator tessellator = Tessellator.getInstance();
        GL11.glPushMatrix();
        GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.05F, (float) posZ + 0.5F);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);

        float alpha = blender.isBlending() ? (blender.progress / 200F) : (blender.drinkCount > 0 ? 1.0F : 0.0F);
        GL11.glColor4f(blender.currentRed / 255F, blender.currentGreen / 255F, blender.currentBlue / 255F,
                alpha);

        float height = blender.isBlending() ? 0.8F : (0.275F + (0.525F * (blender.drinkCount / 6F)));
        GL11.glBegin(GL11.GL_QUADS);

        // North Face
        GL11.glVertex3d(-0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, height, -0.2);
        GL11.glVertex3d(-0.2, height, -0.2);

        // South Face
        GL11.glVertex3d(-0.2, 0.275, 0.2);
        GL11.glVertex3d(0.2, 0.275, 0.2);
        GL11.glVertex3d(0.2, height, 0.2);
        GL11.glVertex3d(-0.2, height, 0.2);

        // West Face
        GL11.glVertex3d(-0.2, 0.275, -0.2);
        GL11.glVertex3d(-0.2, 0.275, 0.2);
        GL11.glVertex3d(-0.2, height, 0.2);
        GL11.glVertex3d(-0.2, height, -0.2);

        // East Face
        GL11.glVertex3d(0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, 0.2);
        GL11.glVertex3d(0.2, height, 0.2);
        GL11.glVertex3d(0.2, height, -0.2);

        // Top Face
        GL11.glVertex3d(-0.2, height, -0.2);
        GL11.glVertex3d(0.2, height, -0.2);
        GL11.glVertex3d(0.2, height, 0.2);
        GL11.glVertex3d(-0.2, height, 0.2);

        // Bottom Face
        GL11.glVertex3d(-0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, 0.2);
        GL11.glVertex3d(-0.2, 0.275, 0.2);

        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);

        GL11.glPopMatrix();
    }
}

From source file:com.mrcrayfish.furniture.render.tileentity.CupRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_,
        int p_180535_9_) {
    TileEntityCup tileEntityCup = (TileEntityCup) tileEntity;
    if (tileEntityCup.getDrink() != null) {
        Tessellator tessellator = Tessellator.getInstance();
        GL11.glPushMatrix();/*from  w w  w .ja v a 2 s .  c  o  m*/
        GL11.glTranslatef((float) posX + 0.5F, (float) posY, (float) posZ + 0.5F);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);

        GL11.glColor4f(tileEntityCup.red / 255F, tileEntityCup.green / 255F, tileEntityCup.blue / 255F, 1.0F);

        GL11.glBegin(GL11.GL_QUADS);

        // North Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.4, -0.125);
        GL11.glVertex3d(-0.125, 0.4, -0.125);

        // South Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(0.125, 0.4, 0.125);
        GL11.glVertex3d(-0.125, 0.4, 0.125);

        // West Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(-0.125, 0.4, 0.125);
        GL11.glVertex3d(-0.125, 0.4, -0.125);

        // East Face
        GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(0.125, 0.4, 0.125);
        GL11.glVertex3d(0.125, 0.4, -0.125);

        // Top Face
        GL11.glVertex3d(-0.125, 0.4, -0.125);
        GL11.glVertex3d(0.125, 0.4, -0.125);
        GL11.glVertex3d(0.125, 0.4, 0.125);
        GL11.glVertex3d(-0.125, 0.4, 0.125);

        // Bottom Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125);

        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);

        GL11.glPopMatrix();
    }
}

From source file:com.mtbs3d.minecrift.gui.framework.GuiSliderEx.java

License:LGPL

/**
 * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).
 *//*  ww  w .j  av  a  2  s. c  o m*/
protected void mouseDragged(Minecraft par1Minecraft, int par2, int par3) {
    if (this.enabled && this.visible) {
        if (this.dragging) {
            if (par2 != this.lastMouseX) {
                this.lastMouseX = -1;
                this.sliderValue = (float) (par2 - (this.xPosition + 4)) / (float) (this.width - 8);

                if (this.sliderValue < 0.0F) {
                    this.sliderValue = 0.0F;
                }

                if (this.sliderValue > 1.0F) {
                    this.sliderValue = 1.0F;
                }

                float range = this.maxValue - this.minValue;
                this.lastValue = this.minValue + (this.sliderValue * range);
                this.lastValue = Math.round(this.lastValue / this.increment) * this.increment;

                // Save original
                float original = par1Minecraft.vrSettings.getOptionFloatValue(this.idFloat);

                // Get updated display string...
                par1Minecraft.vrSettings.setOptionFloatValue(this.idFloat, this.lastValue);
                this.displayString = par1Minecraft.vrSettings.getKeyBinding(this.idFloat);

                // ...but then set back to original value for now, until mouse released
                par1Minecraft.vrSettings.setOptionFloatValue(this.idFloat, original);
            }
        }

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.drawTexturedModalRect(this.xPosition + (int) (this.sliderValue * (float) (this.width - 8)),
                this.yPosition, 0, 66, 4, 20);
        this.drawTexturedModalRect(this.xPosition + (int) (this.sliderValue * (float) (this.width - 8)) + 4,
                this.yPosition, 196, 66, 4, 20);
    }
}