Example usage for org.lwjgl.opengl GL11 glColor3d

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

Introduction

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

Prototype

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

Source Link

Document

Double version of #glColor3b Color3b

Usage

From source file:spaceshooter.entities.EntityEnemy.java

License:Creative Commons License

@Override
public void draw() {
    GL11.glPushMatrix();/*from   w w w  .  j a  v a 2  s.co m*/

    GL11.glColor3d(100, 0, 0);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + width, y);
    GL11.glVertex2f(x + width, y + height);
    GL11.glVertex2f(x, y + height);
    GL11.glEnd();

    GL11.glPopMatrix();
}

From source file:spaceshooter.entities.EntityPlayer.java

License:Creative Commons License

@Override
public void draw() {
    GL11.glColor3d(0, 0, 100);

    GL11.glBegin(GL11.GL_QUADS);/*from   ww  w .  j  a  v  a2  s  . co  m*/
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + width, y);
    GL11.glVertex2f(x + width, y + height);
    GL11.glVertex2f(x, y + height);
    GL11.glEnd();
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glColor3d(double a, double b, double c) {
    GL11.glColor3d(a, b, c);
}

From source file:tk.wurst_client.features.mods.TrajectoriesMod.java

License:Open Source License

@Override
public void onRender() {
    EntityPlayerSP player = mc.player;//from www  .  j av  a  2 s.com

    // check if player is holding item
    ItemStack stack = player.inventory.getCurrentItem();
    if (stack == null)
        return;

    // check if item is throwable
    Item item = stack.getItem();
    if (!(item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg
            || item instanceof ItemEnderPearl || item instanceof ItemSplashPotion
            || item instanceof ItemLingeringPotion || item instanceof ItemFishingRod))
        return;

    boolean usingBow = player.inventory.getCurrentItem().getItem() instanceof ItemBow;

    // calculate starting position
    double arrowPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * mc.timer.renderPartialTicks
            - MathHelper.cos((float) Math.toRadians(player.rotationYaw)) * 0.16F;
    double arrowPosY = player.lastTickPosY
            + (player.posY - player.lastTickPosY) * Minecraft.getMinecraft().timer.renderPartialTicks
            + player.getEyeHeight() - 0.1;
    double arrowPosZ = player.lastTickPosZ
            + (player.posZ - player.lastTickPosZ) * Minecraft.getMinecraft().timer.renderPartialTicks
            - MathHelper.sin((float) Math.toRadians(player.rotationYaw)) * 0.16F;

    // calculate starting motion
    float arrowMotionFactor = usingBow ? 1F : 0.4F;
    float yaw = (float) Math.toRadians(player.rotationYaw);
    float pitch = (float) Math.toRadians(player.rotationPitch);
    float arrowMotionX = -MathHelper.sin(yaw) * MathHelper.cos(pitch) * arrowMotionFactor;
    float arrowMotionY = -MathHelper.sin(pitch) * arrowMotionFactor;
    float arrowMotionZ = MathHelper.cos(yaw) * MathHelper.cos(pitch) * arrowMotionFactor;
    double arrowMotion = Math
            .sqrt(arrowMotionX * arrowMotionX + arrowMotionY * arrowMotionY + arrowMotionZ * arrowMotionZ);
    arrowMotionX /= arrowMotion;
    arrowMotionY /= arrowMotion;
    arrowMotionZ /= arrowMotion;
    if (usingBow) {
        float bowPower = (72000 - player.getItemInUseCount()) / 20F;
        bowPower = (bowPower * bowPower + bowPower * 2F) / 3F;

        if (bowPower > 1F)
            bowPower = 1F;

        if (bowPower <= 0.1F)
            bowPower = 1F;

        bowPower *= 3F;
        arrowMotionX *= bowPower;
        arrowMotionY *= bowPower;
        arrowMotionZ *= bowPower;
    } else {
        arrowMotionX *= 1.5D;
        arrowMotionY *= 1.5D;
        arrowMotionZ *= 1.5D;
    }

    // GL settings
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glDisable(2929);
    GL11.glEnable(GL13.GL_MULTISAMPLE);
    GL11.glDepthMask(false);
    GL11.glLineWidth(1.8F);

    RenderManager renderManager = mc.getRenderManager();

    // draw trajectory line
    double gravity = usingBow ? 0.05D
            : item instanceof ItemPotion ? 0.4D : item instanceof ItemFishingRod ? 0.15D : 0.03D;
    Vec3d playerVector = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
    GL11.glColor3d(0, 1, 0);
    GL11.glBegin(GL11.GL_LINE_STRIP);
    for (int i = 0; i < 1000; i++) {
        GL11.glVertex3d(arrowPosX - renderManager.renderPosX, arrowPosY - renderManager.renderPosY,
                arrowPosZ - renderManager.renderPosZ);

        arrowPosX += arrowMotionX * 0.1;
        arrowPosY += arrowMotionY * 0.1;
        arrowPosZ += arrowMotionZ * 0.1;
        arrowMotionX *= 0.999D;
        arrowMotionY *= 0.999D;
        arrowMotionZ *= 0.999D;
        arrowMotionY -= gravity * 0.1;

        if (mc.world.rayTraceBlocks(playerVector, new Vec3d(arrowPosX, arrowPosY, arrowPosZ)) != null)
            break;
    }
    GL11.glEnd();

    // draw end of trajectory line
    double renderX = arrowPosX - renderManager.renderPosX;
    double renderY = arrowPosY - renderManager.renderPosY;
    double renderZ = arrowPosZ - renderManager.renderPosZ;
    AxisAlignedBB bb = new AxisAlignedBB(renderX - 0.5, renderY - 0.5, renderZ - 0.5, renderX + 0.5,
            renderY + 0.5, renderZ + 0.5);
    GL11.glColor4f(0F, 1F, 0F, 0.15F);
    RenderUtils.drawColorBox(bb, 0F, 1F, 0F, 0.15F);
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderUtils.drawSelectionBoundingBox(bb);

    // GL resets
    GL11.glDisable(3042);
    GL11.glEnable(3553);
    GL11.glEnable(2929);
    GL11.glDisable(GL13.GL_MULTISAMPLE);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glPopMatrix();
}