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.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawFullCircle(int cx, int cy, double r, int c) {
    GL11.glScalef(0.5F, 0.5F, 0.5F);/*from  ww w  . j  a  v a2  s. c om*/
    r *= 2;
    cx *= 2;
    cy *= 2;
    float f = (float) (c >> 24 & 0xff) / 255F;
    float f1 = (float) (c >> 16 & 0xff) / 255F;
    float f2 = (float) (c >> 8 & 0xff) / 255F;
    float f3 = (float) (c & 0xff) / 255F;
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    for (int i = 0; i <= 360; i++) {
        double x = Math.sin((i * Math.PI / 180)) * r;
        double y = Math.cos((i * Math.PI / 180)) * r;
        GL11.glVertex2d(cx + x, cy + y);
    }
    GL11.glEnd();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glScalef(2F, 2F, 2F);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawLogoutSpotTracer(LogoutSpot l) {
    try {//from   www .  j  a  va2 s.  co  m
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);

        GL11.glColor3d(l.red, l.green, l.blue);
        GL11.glBegin(GL11.GL_LINE_LOOP);
        GL11.glVertex3d(0, 0, 0);
        GL11.glVertex3d(l.dX + 0.5, l.dY + 0.5, l.dZ + 0.5);
        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    } catch (Exception e) {
    }
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawWayPointTracer(Waypoint w) {
    try {//from  w  w w  . j  a  v  a 2s  . c  o m
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);
        GL11.glColor3d(w.red, w.green, w.blue);
        GL11.glBegin(GL11.GL_LINE_LOOP);
        Vec3d eyes = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Wrapper.getPlayer().rotationPitch))
                .rotateYaw(-(float) Math.toRadians(Wrapper.getPlayer().rotationYaw));

        GL11.glVertex3d(eyes.xCoord, Wrapper.getPlayer().getEyeHeight() + eyes.yCoord, eyes.zCoord);
        GL11.glVertex3d(w.dX + 0.5, w.dY + 0.5, w.dZ + 0.5);
        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    } catch (Exception e) {
    }
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawPlayerESP(double d, double d1, double d2, EntityPlayer ep, double e, double f) {
    if (!(ep instanceof EntityPlayerSP)) {
        GL11.glPushMatrix();/*from w  w w.j  a  v  a  2s .  co m*/
        GL11.glEnable(3042);
        if (Wrapper.getFriends().isFriend(ep.getName())) {
            GL11.glColor4f(0.0F, 1F, 0.0F, 0.15F);
        } else {
            GL11.glColor4f(0.7F, 0.0F, 0.0F, 0.15F);
        }
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
        GL11.glLineWidth(1.0F);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        drawBoundingBox(new AxisAlignedBB(d - f, d1 + 0.1, d2 - f, d + f, d1 + e + 0.25, d2 + f));
        if (Wrapper.getFriends().isFriend(ep.getName())) {
            GL11.glColor4f(0.0F, 1F, 0.0F, 1F);
        } else {
            GL11.glColor4f(0.7F, 0.0F, 0.0F, 1F);
        }
        drawOutlinedBoundingBox(new AxisAlignedBB(d - f, d1 + 0.1, d2 - f, d + f, d1 + e + 0.25, d2 + f));
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(3042);
        GL11.glPopMatrix();
    }
}

From source file:com.darkona.adventurebackpack.client.render.CopygirlRenderUtils.java

License:Open Source License

public static void renderItemIn3d(ItemStack stack) {
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    // Not sure why but this can be null when the world loads.
    if (textureManager == null) {
        return;/*w w  w.  j  a  v a  2  s.  c o m*/
    }
    Item item = stack.getItem();

    GL11.glPushMatrix();

    Tessellator tessellator = Tessellator.instance;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.5F, -0.5F, 1 / 32.0F);

    int passes = item.getRenderPasses(stack.getItemDamage());
    for (int pass = 0; pass < passes; pass++) {
        textureManager.bindTexture(((stack.getItemSpriteNumber() == 0) ? TextureMap.locationBlocksTexture
                : TextureMap.locationItemsTexture));
        IIcon icon = item.getIcon(stack, pass);
        if (icon != null) {
            float minU = icon.getMinU();
            float maxU = icon.getMaxU();
            float minV = icon.getMinV();
            float maxV = icon.getMaxV();
            CopygirlRenderUtils.setColorFromInt(item.getColorFromItemStack(stack, pass));
            ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(),
                    icon.getIconHeight(), 0.0625F);
        }
    }

    if (stack.hasEffect(0)) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        textureManager.bindTexture(glint);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);

    GL11.glPopMatrix();
}

From source file:com.darkona.adventurebackpack.client.render.CopygirlRenderUtils.java

License:Open Source License

public static void setColorFromInt(int color) {
    float r = (color >> 16 & 255) / 255.0F;
    float g = (color >> 8 & 255) / 255.0F;
    float b = (color & 255) / 255.0F;
    GL11.glColor4f(r, g, b, 1.0F);
}

From source file:com.dechiridas.letsmod.client.gui.inventory.GuiGenericFurnace.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    // Draw your GUI here, only thing you need to change is the path
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(Textures.GUI_GENERIC_FURNACE);
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;
    this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}

From source file:com.dinasgames.engine.graphics.GL.java

public static void setColor(GLColor color) {
    GL11.glColor4f(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
}

From source file:com.dyonovan.neotech.client.gui.misc.GuiCrafter.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    mc.renderEngine.bindTexture(background);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

From source file:com.eagle.resonantreflux.gui.GuiFluxCrystallizationChamber.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(Dictionary.GUI_CRYSTALCHAMBER);
    int x2 = (width - xSize) / 2;
    int y2 = (height - ySize) / 2;
    this.drawTexturedModalRect(x2, y2, 0, 0, xSize, ySize);
}