Example usage for org.lwjgl.opengl GL11 glColor4d

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

Introduction

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

Prototype

public static native void glColor4d(@NativeType("GLdouble") double red, @NativeType("GLdouble") double green,
        @NativeType("GLdouble") double blue, @NativeType("GLdouble") double alpha);

Source Link

Document

Double version of #glColor4b Color4b

Usage

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

/**
 * Draws a colored cube with the size of vector. All faces have the specified color. This uses OpenGL
 *
 * @author Koen Beckers (K4Unl) and Amadornes
 * @param vector//w w w .  j  a  v a  2  s .  c  om
 * @param color
 */
public static void drawColoredCube(Vec3dCube vector, double r, double g, double b, double a,
        boolean... renderFaces) {

    GL11.glColor4d(r, g, b, a);

    // Top side
    if (renderFaces.length < 1 || renderFaces[0]) {
        GL11.glNormal3d(0, 1, 0);
        addVertex(vector.getMinX(), vector.getMaxY(), vector.getMaxZ());
        addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ());
        addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMinZ());
        addVertex(vector.getMinX(), vector.getMaxY(), vector.getMinZ());
    }

    // Bottom side
    if (renderFaces.length < 2 || renderFaces[1]) {
        GL11.glNormal3d(0, -1, 0);
        addVertex(vector.getMaxX(), vector.getMinY(), vector.getMaxZ());
        addVertex(vector.getMinX(), vector.getMinY(), vector.getMaxZ());
        addVertex(vector.getMinX(), vector.getMinY(), vector.getMinZ());
        addVertex(vector.getMaxX(), vector.getMinY(), vector.getMinZ());
    }

    // Draw west side:
    if (renderFaces.length < 3 || renderFaces[2]) {
        GL11.glNormal3d(-1, 0, 0);
        addVertex(vector.getMinX(), vector.getMinY(), vector.getMaxZ());
        addVertex(vector.getMinX(), vector.getMaxY(), vector.getMaxZ());
        addVertex(vector.getMinX(), vector.getMaxY(), vector.getMinZ());
        addVertex(vector.getMinX(), vector.getMinY(), vector.getMinZ());
    }

    // Draw east side:
    if (renderFaces.length < 4 || renderFaces[3]) {
        GL11.glNormal3d(1, 0, 0);
        addVertex(vector.getMaxX(), vector.getMinY(), vector.getMinZ());
        addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMinZ());
        addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ());
        addVertex(vector.getMaxX(), vector.getMinY(), vector.getMaxZ());
    }

    // Draw north side
    if (renderFaces.length < 5 || renderFaces[4]) {
        GL11.glNormal3d(0, 0, -1);
        addVertex(vector.getMinX(), vector.getMinY(), vector.getMinZ());
        addVertex(vector.getMinX(), vector.getMaxY(), vector.getMinZ());
        addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMinZ());
        addVertex(vector.getMaxX(), vector.getMinY(), vector.getMinZ());
    }

    // Draw south side
    if (renderFaces.length < 6 || renderFaces[5]) {
        GL11.glNormal3d(0, 0, 1);
        addVertex(vector.getMinX(), vector.getMinY(), vector.getMaxZ());
        addVertex(vector.getMaxX(), vector.getMinY(), vector.getMaxZ());
        addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ());
        addVertex(vector.getMinX(), vector.getMaxY(), vector.getMaxZ());
    }

    GL11.glColor4d(1, 1, 1, 1);
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

/**
 * Draws a colored cube with the size of vector. All faces have the specified color. This uses Tesselator
 *
 * @author Koen Beckers (K4Unl) and Amadornes
 * @param vector/* w  w  w .ja v  a  2  s. co  m*/
 * @param color
 */
public static void drawTesselatedColoredCube(Vec3dCube vector, int r, int g, int b, int a) {

    Tessellator t = Tessellator.instance;
    boolean wasTesselating = false;

    // Check if we were already tesselating
    try {
        t.startDrawingQuads();
    } catch (IllegalStateException e) {
        wasTesselating = true;

    }

    t.setColorRGBA(r, g, b, a);

    t.setNormal(0, 1, 0);
    t.addVertex(vector.getMinX(), vector.getMaxY(), vector.getMaxZ());
    t.addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ());
    t.addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMinZ());
    t.addVertex(vector.getMinX(), vector.getMaxY(), vector.getMinZ());

    // Bottom side
    t.setNormal(0, -1, 0);
    t.addVertex(vector.getMaxX(), vector.getMinY(), vector.getMaxZ());
    t.addVertex(vector.getMinX(), vector.getMinY(), vector.getMaxZ());
    t.addVertex(vector.getMinX(), vector.getMinY(), vector.getMinZ());
    t.addVertex(vector.getMaxX(), vector.getMinY(), vector.getMinZ());

    // Draw west side:
    t.setNormal(-1, 0, 0);
    t.addVertex(vector.getMinX(), vector.getMinY(), vector.getMaxZ());
    t.addVertex(vector.getMinX(), vector.getMaxY(), vector.getMaxZ());
    t.addVertex(vector.getMinX(), vector.getMaxY(), vector.getMinZ());
    t.addVertex(vector.getMinX(), vector.getMinY(), vector.getMinZ());

    // Draw east side:
    t.setNormal(1, 0, 0);
    t.addVertex(vector.getMaxX(), vector.getMinY(), vector.getMinZ());
    t.addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMinZ());
    t.addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ());
    t.addVertex(vector.getMaxX(), vector.getMinY(), vector.getMaxZ());

    // Draw north side
    t.setNormal(0, 0, -1);
    t.addVertex(vector.getMinX(), vector.getMinY(), vector.getMinZ());
    t.addVertex(vector.getMinX(), vector.getMaxY(), vector.getMinZ());
    t.addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMinZ());
    t.addVertex(vector.getMaxX(), vector.getMinY(), vector.getMinZ());

    // Draw south side
    t.setNormal(0, 0, 1);
    t.addVertex(vector.getMinX(), vector.getMinY(), vector.getMaxZ());
    t.addVertex(vector.getMaxX(), vector.getMinY(), vector.getMaxZ());
    t.addVertex(vector.getMaxX(), vector.getMaxY(), vector.getMaxZ());
    t.addVertex(vector.getMinX(), vector.getMaxY(), vector.getMaxZ());

    GL11.glColor4d(1, 1, 1, 1);

    if (!wasTesselating) {
        t.draw();
    }
}

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

License:Open Source License

/**
 * Renders a box with any size and any color.
 *
 * @param x/*from w w  w .java2s.com*/
 * @param y
 * @param z
 * @param x2
 * @param y2
 * @param z2
 * @param color
 */
public static void box(double x, double y, double z, double x2, double y2, double z2, float red, float green,
        float blue, float alpha) {
    x = x - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y = y - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z = z - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    x2 = x2 - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y2 = y2 - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z2 = z2 - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glDepthMask(false);
    GL11.glColor4f(red, green, blue, alpha);
    drawColorBox(new AxisAlignedBB(x, y, z, x2, y2, z2), red, green, blue, alpha);
    GL11.glColor4d(0, 0, 0, 0.5F);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

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

License:Open Source License

/**
 * Renders an ESP box with the size of a normal block at the specified
 * BlockPos.//w  w w . j  av a 2  s .c  o m
 */
public static void blockEsp(BlockPos blockPos, Color c, double length, double length2) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glPushMatrix();
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 0.15);
    drawColorBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length), 0F, 0F, 0F, 0F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length));
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
    GL11.glPopMatrix();
}

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

License:Open Source License

public static void blockEspFrame(BlockPos blockPos, double red, double green, double blue) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);/*  w  ww . j a v  a  2 s.c o  m*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(red, green, blue, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

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

License:Open Source License

public static void blockEspBox(BlockPos blockPos, double red, double green, double blue) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);/*from   w  w  w  .  ja  va 2s.  c  om*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(red, green, blue, 0.15F);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), 0F, 0F, 0F, 0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

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

License:Open Source License

public static void emptyBlockESPBox(BlockPos blockPos) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);/*from  w  w w  .  j a  v a 2 s  . com*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(0, 0, 0, 0.5F);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

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

License:Open Source License

public static void nukerBox(BlockPos blockPos, float damage) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);/*  w w w  . j a  v  a  2s. co m*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4f(damage, 1 - damage, 0, 0.15F);
    drawColorBox(
            new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2, z + 0.5 - damage / 2,
                    x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2),
            damage, 1 - damage, 0, 0.15F);
    GL11.glColor4d(0, 0, 0, 0.5F);
    drawSelectionBoundingBox(new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2, z + 0.5 - damage / 2,
            x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

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

License:Open Source License

public static void searchBox(BlockPos blockPos) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);//from   ww  w.j a  va2s.co m
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    float sinus = 1F - MathHelper
            .abs(MathHelper.sin(Minecraft.getSystemTime() % 10000L / 10000.0F * (float) Math.PI * 4.0F) * 1F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4f(1F - sinus, sinus, 0F, 0.15F);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), 1F - sinus, sinus, 0F, 0.15F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

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

License:Open Source License

public static void drawESP(double d, double d1, double d2, double r, double b, double g) {
    GL11.glPushMatrix();/*from  w  w  w. ja v  a 2 s  . c o m*/
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1.5F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(1.0F);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(2929);
    GL11.glDepthMask(false);
    GL11.glColor4d(r, g, b, 0.1825F);
    drawColorBox(new AxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0), 0F, 0F, 0F, 0F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0));
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(2929);
    GL11.glDepthMask(true);
    GL11.glDisable(3042);
    GL11.glPopMatrix();
}