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:tk.wurst_client.utils.RenderUtils.java

License:Open Source License

public static void tracerLine(Entity entity, int mode) {
    double x = entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = entity.posY + entity.height / 2 - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    glBlendFunc(770, 771);//ww w. j a v a2  s  .c  o m
    glEnable(GL_BLEND);
    glLineWidth(2.0F);
    glDisable(GL11.GL_TEXTURE_2D);
    glDisable(GL_DEPTH_TEST);
    glDepthMask(false);
    if (mode == 0)// Enemy
        GL11.glColor4d(1 - Minecraft.getMinecraft().player.getDistanceToEntity(entity) / 40,
                Minecraft.getMinecraft().player.getDistanceToEntity(entity) / 40, 0, 0.5F);
    else if (mode == 1)// Friend
        GL11.glColor4d(0, 0, 1, 0.5F);
    else if (mode == 2)// Other
        GL11.glColor4d(1, 1, 0, 0.5F);
    else if (mode == 3)// Target
        GL11.glColor4d(1, 0, 0, 0.5F);
    else if (mode == 4)// Team
        GL11.glColor4d(0, 1, 0, 0.5F);

    Vec3d eyes = new Vec3d(0, 0, 1)
            .rotatePitch(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationPitch))
            .rotateYaw(-(float) Math.toRadians(Minecraft.getMinecraft().player.rotationYaw));

    glBegin(GL_LINES);
    {
        glVertex3d(eyes.xCoord, Minecraft.getMinecraft().player.getEyeHeight() + eyes.yCoord, eyes.zCoord);
        glVertex3d(x, y, z);
    }
    glEnd();
    glEnable(GL11.GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glDepthMask(true);
    glDisable(GL_BLEND);
}