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.sparkst3r.anotherworld.world.gui.GuiBackpackContents.java

License:Open Source License

/** 
 * Draws everything behind the slots// w  ww .  j  av a 2 s  .com
 */
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    this.drawDefaultBackground();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(GuiBackpackContents.TEXTURE);
    int xTextPos = (width - xTextSize) / 2;
    int yTextPos = (height - yTextSize) / 2;
    this.drawTexturedModalRect(xTextPos, yTextPos, 0, 0, xTextSize, yTextSize);

    int pouchLevel = backpackStack.getTagCompound().getInteger("pouchLevel");

    if (pouchLevel != -1) {
        switch (pouchLevel) {
        case 4: {
            this.drawTexturedModalRect(xTextPos + 87, yTextPos + 82, 192, 4, overlaySize, overlaySize);
        }
        case 3: {
            this.drawTexturedModalRect(xTextPos + 29, yTextPos + 82, 192, 4, overlaySize, overlaySize);
        }
        case 2: {
            this.drawTexturedModalRect(xTextPos + 87, yTextPos + 24, 192, 4, overlaySize, overlaySize);
        }
        case 1: {
            this.drawTexturedModalRect(xTextPos + 29, yTextPos + 24, 192, 4, overlaySize, overlaySize);
        }
        }
    }

}

From source file:com.sparkst3r.anotherworld.world.gui.GuiTodoList.java

License:Open Source License

/**
 * Draws the GUI//from   w  w w .  j  a  v  a  2s . co  m
 */
@Override
public void drawScreen(int x, int y, float f) {
    this.drawDefaultBackground();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(this.texture);
    int xTextPos = (width - xTextSize) / 2;
    int yTextPos = (height - yTextSize) / 2;
    this.drawTexturedModalRect(xTextPos, yTextPos, 0, 0, xTextSize, yTextSize);
    this.testbutton.drawButton(this.mc, xTextPos + 40, yTextPos + 40);
}

From source file:com.spawck.hs2.client.renderer.model.ModelSoul.java

License:GNU General Public License

@Override
public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) {
    GL11.glPushMatrix();/*from   ww  w  .  j  a  v  a2  s .co  m*/
    GL11.glScalef(1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(0.0F, -0.5F, 0.0F);

    if (this.base != null) {
        this.base.render(par7);
    }

    GL11.glEnable(2977);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0.0F, 0.8F + par4, 0.0F);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    this.glass.render(par7);
    float var8 = 0.875F;
    GL11.glScalef(var8, var8, var8);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    this.glass.render(par7);
    GL11.glScalef(var8, var8, var8);
    GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F);
    GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F);
    this.cube.render(par7);
    GL11.glDepthFunc(514);
    GL11.glDisable(2896);
    GL11.glEnable(3042);
    GL11.glBlendFunc(768, 1);
    float var14 = 0.76F;
    GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F);
    GL11.glMatrixMode(5890);
    GL11.glPushMatrix();
    float var15 = 0.125F;
    GL11.glScalef(var15, var15, var15);
    float var16 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
    GL11.glTranslatef(var16, 0.0F, 0.0F);
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    this.cube.render(par7);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glScalef(var15, var15, var15);
    var16 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
    GL11.glTranslatef(-var16, 0.0F, 0.0F);
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
    this.cube.render(par7);
    GL11.glPopMatrix();
    GL11.glMatrixMode(5888);
    GL11.glDisable(3042);
    GL11.glEnable(2896);
    GL11.glDepthFunc(515);
    GL11.glPopMatrix();
}

From source file:com.specialeffect.gui.IconOverlay.java

License:Open Source License

private void drawTexture() {
    // calculate position
    int height = (int) (mDisplayHeight * mHeight);
    int width = (int) (height * mAspectRatio);
    int centreX = (int) (mCentreX * mDisplayWidth);
    int centreY = (int) (mCentreY * mDisplayHeight);

    GL11.glDisable(GL11.GL_LIGHTING);/* w w  w . ja v  a2 s .  c o m*/
    GL11.glPushAttrib(GL11.GL_TEXTURE_BIT);

    this.mc.renderEngine.bindTexture(mResource);

    GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD);

    GL11.glColor4f(1.0f, 1.0f, 1.0f, mAlpha);

    ModUtils.drawTexQuad(centreX - width / 2, centreY - height / 2, width, height);

    // reset GL attributes!
    GL11.glPopAttrib();

}

From source file:com.specialeffect.gui.JoystickControlOverlay.java

License:Open Source License

@SubscribeEvent
public void onRenderExperienceBar(RenderGameOverlayEvent event) {

    // We draw after the ExperienceBar has drawn.  The event raised by GuiIngameForge.pre()
    // will return true from isCancelable.  If you call event.setCanceled(true) in
    // that case, the portion of rendering which this event represents will be canceled.
    // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns
    // false and that the eventType represents the ExperienceBar event.
    if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) {
        return;/*from w  w  w .  j  a va2  s  . c om*/
    }

    if (mVisible) {

        this.rescale();

        GL11.glDisable(GL11.GL_LIGHTING);

        this.mc.renderEngine.bindTexture(mResource);

        GL11.glPushAttrib(GL11.GL_TEXTURE_BIT);
        GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD);

        GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.5f);

        ModUtils.drawTexQuad(0, 0, mDisplayWidth, mDisplayHeight);

        // reset GL attributes!
        GL11.glPopAttrib();
    }

}

From source file:com.specialeffect.gui.StateOverlay.java

License:Open Source License

private void drawScaledTextureWithGlow(ResourceLocation res, int x, int y, int width, int height) {
    GL11.glPushAttrib(GL11.GL_TEXTURE_BIT);

    this.mc.renderEngine.bindTexture(res);

    // First draw enlarged and blurred, for glow.
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);

    GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD);

    // We draw the texture larger, in white, at progressive levels of alpha 
    // for blur effect (the alpha gets added on each layer)
    int blurSteps = 4; // how many levels of progressive blur
    double totalBlur = width / 12; // in pixels      
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f / blurSteps);

    for (int i = 0; i < blurSteps; i++) {
        double blurAmount = totalBlur / blurSteps * (i + 1);
        ModUtils.drawTexQuad(x - blurAmount, y - blurAmount, width + 2 * blurAmount, height + 2 * blurAmount);
    }//  w w  w .j a va 2 s .  com

    GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
    GL11.glColor3f(1.0f, 1.0f, 1.0f);
    this.mc.renderEngine.bindTexture(res);
    ModUtils.drawTexQuad(x, y, width, height);

    // reset GL attributes!
    GL11.glPopAttrib();

}

From source file:com.specialeffect.gui.StateOverlay.java

License:Open Source License

@SubscribeEvent
public void onRenderExperienceBar(RenderGameOverlayEvent event) {

    // We draw after the ExperienceBar has drawn.  The event raised by GuiIngameForge.pre()
    // will return true from isCancelable.  If you call event.setCanceled(true) in
    // that case, the portion of rendering which this event represents will be canceled.
    // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns
    // false and that the eventType represents the ExperienceBar event.
    if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) {
        return;/*from   w w w .ja v  a2 s .  com*/
    }

    // Don't show if the debug screen is open
    if (Minecraft.getMinecraft().gameSettings.showDebugInfo) {
        return;
    }

    this.rescale();

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);

    // LEFT icons
    int xPos = mIconPadding;
    int yPos = mIconPadding;
    for (int i = 0; i < mResourcesLeft.size(); i++) {
        if (mFlagsLeft.get(i)) {
            drawScaledTextureWithGlow(mResourcesLeft.get(i), xPos, yPos, mIconSize, mIconSize);
        }
        xPos += mIconSize + mIconPadding;
    }

    // RIGHT ICONS
    xPos = mDisplayWidth - mIconSize - mIconPadding;
    for (int i = 0; i < mResourcesRight.size(); i++) {
        if (mFlagsRight.get(i)) {
            drawScaledTextureWithGlow(mResourcesRight.get(i), xPos, yPos, mIconSize, mIconSize);
        }
        xPos -= (mIconSize + mIconPadding);
    }
}

From source file:com.sr2610.steampunkd.client.gui.handbook.buttons.GuiBackButton.java

License:Creative Commons License

@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
    hovered = (mouseX >= xPosition) && (mouseY >= yPosition) && (mouseX < (xPosition + width))
            && (mouseY < (yPosition + height));
    final int hoverState = getHoverState(hovered);

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

}

From source file:com.sr2610.steampunkd.client.gui.handbook.buttons.GuiNavigationButton.java

License:Creative Commons License

@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
    if (enabled) {
        hovered = (mouseX >= xPosition) && (mouseY >= yPosition) && (mouseX < (xPosition + width))
                && (mouseY < (yPosition + height));
        final int hoveredState = getHoverState(hovered);

        minecraft.renderEngine.bindTexture(GuiHandbook.texture);
        GL11.glColor4f(1F, 1F, 1F, 1F);
        drawTexturedModalRect(xPosition, yPosition, hoveredState == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
    }/* w w  w  .j a  va2 s .  c o  m*/
}

From source file:com.sr2610.steampunkd.client.gui.handbook.GuiHandbook.java

License:Creative Commons License

@Override
public void drawScreen(int mouseX, int mouseY, float ticks) {
    GL11.glColor4f(1F, 1F, 1F, 1F);
    final boolean unicode = fontRendererObj.getUnicodeFlag();
    fontRendererObj.setUnicodeFlag(true);
    mc.renderEngine.bindTexture(texture);
    drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);
    drawHeader();/*from   w  w  w  .ja v  a 2s  .co  m*/
    fontRendererObj.setUnicodeFlag(unicode);
    super.drawScreen(mouseX, mouseY, ticks);
}