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:me.lixko.lixkopack.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 .jav  a  2s.  c om*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(damage, 1 - damage, 0, 0.15F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    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));
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(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), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.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  v  a2  s  .c  o  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.glColor4d(1 - sinus, sinus, 0, 0.15);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glColor4d(0, 0, 0, 0.5);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.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);//from www  .j ava 2 s . com
    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().thePlayer.getDistanceToEntity(entity) / 40,
                Minecraft.getMinecraft().thePlayer.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);
    glBegin(GL_LINES);
    {
        glVertex3d(0, Minecraft.getMinecraft().thePlayer.getEyeHeight(), 0);
        glVertex3d(x, y, z);
    }
    glEnd();
    glEnable(GL11.GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);
    glDepthMask(true);
    glDisable(GL_BLEND);
}

From source file:minesweeperMod.client.FieldStatHandler.java

License:LGPL

@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event) {
    if (MinesweeperMod.instance.configStatEnabled) {
        Minecraft minecraft = FMLClientHandler.instance().getClient();
        EntityPlayer player = minecraft.thePlayer;
        if (player != null) {
            World world = minecraft.theWorld;
            boolean shouldUpdate = false;
            if (!isTriggeredThisTick && player.ticksExisted % 20 == 0) {
                isTriggeredThisTick = true;
                shouldUpdate = true;//ww w .j  av a  2 s . co m
            } else if (player.ticksExisted % 20 != 0) {
                isTriggeredThisTick = false;
            }
            ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth,
                    minecraft.displayHeight);
            GL11.glDepthMask(false);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glPushMatrix();
            GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
            GL11.glColor4d(0, 1, 0, 0.8D);

            if (minesweeperStat == null) {
                minesweeperStat = new GuiAnimatedStat("Minefield Statistics:", sr.getScaledWidth() - 2, 2,
                        0x3000AA00, null, true);
                minesweeperStat.setMinDimensionsAndReset(0, 0);
            }
            List<String> textList = new ArrayList<String>();
            if (world.getBlock(x, y, z) == MinesweeperMod.blockMinesweeper) {
                minesweeperStat.openWindow();
                if (shouldUpdate || forceUpdate) {
                    List<int[]> tiles = new ArrayList<int[]>();
                    ((BlockMinesweeper) MinesweeperMod.blockMinesweeper).getAccessoryTiles(tiles, world, x, y,
                            z);
                    flagCount = 0;
                    bombCount = 0;
                    int hardcoreBombCount = 0;
                    for (int[] tile : tiles) {
                        if (MinesweeperUtils.isTileBomb(world.getBlockMetadata(tile[0], tile[1], tile[2])))
                            bombCount++;
                        if (MinesweeperUtils.isTileFlagged(world.getBlockMetadata(tile[0], tile[1], tile[2])))
                            flagCount++;
                        if (MinesweeperUtils
                                .isTileHardcoreBomb(world.getBlockMetadata(tile[0], tile[1], tile[2])))
                            hardcoreBombCount++;

                    }
                    tileBombRatio = (double) bombCount / (double) tiles.size();
                    hardcoreBombPercentage = (double) hardcoreBombCount / (double) bombCount;
                    statHoldTimer--;
                    if (forceUpdate)
                        statHoldTimer = MinesweeperMod.instance.configStatDuration;
                    forceUpdate = false;
                    if (statHoldTimer <= 0) {
                        x = 0;
                        y = 0;
                        z = 0;
                    }
                }
                textList.add("   Mines: " + bombCount);
                textList.add("Flagged: " + flagCount);
                textList.add("           -- -");
                textList.add("    Left: " + (bombCount - flagCount));
                if (tileBombRatio > 1D / 6D && hardcoreBombPercentage > 0.5D) {
                    textList.add("Difficulty: Hardcore");
                } else if (tileBombRatio > 1D / 6D) {
                    textList.add("Difficulty: Hard");
                } else if (tileBombRatio > 1D / 8D) {
                    textList.add("Difficulty: Medium");
                } else {
                    textList.add("Difficulty: Easy");
                }
            } else {
                minesweeperStat.closeWindow();
            }

            int xPos = 0;
            int yPos = 1;

            switch (MinesweeperMod.instance.configStatXPos) {
            case 0:
                xPos = 2;
                minesweeperStat.leftSided = false;
                break;
            case 1:
                xPos = sr.getScaledWidth() / 2 - 55;
                minesweeperStat.leftSided = false;
                break;
            case 2:
                xPos = sr.getScaledWidth() - 2;
                minesweeperStat.leftSided = true;
                break;
            }

            switch (MinesweeperMod.instance.configStatYPos) {
            case 0:
                yPos = 2;
                break;
            case 1:
                yPos = sr.getScaledHeight() / 2 - 40;
                break;
            case 2:
                yPos = sr.getScaledHeight() - 68;
                break;
            }

            minesweeperStat.updateResolution(xPos, yPos);
            minesweeperStat.render(minecraft.fontRenderer, textList, 0);
            GL11.glPopMatrix();
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glDepthMask(true);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
        }
    }
}

From source file:minesweeperMod.client.GuiAnimatedStat.java

License:LGPL

public void render(FontRenderer fontRenderer, List<String> textList, float zLevel) {
    doneExpanding = true;/*from  ww w.  java 2 s.  c  o  m*/
    if (isClicked) {
        // calculate the width and height needed for the box to fit the
        // strings.
        int maxWidth = fontRenderer.getStringWidth(title);
        int maxHeight = 12;
        if (textList.size() > 0) {
            maxHeight += 4 + textList.size() * 10;
        }
        for (String line : textList) {
            if (fontRenderer.getStringWidth(line) > maxWidth)
                maxWidth = fontRenderer.getStringWidth(line);
        }
        maxWidth += 20;

        // expand the box

        for (int i = 0; i < ANIMATED_STAT_SPEED; i++) {
            if (width < maxWidth) {
                width++;
                doneExpanding = false;
            }
            if (height < maxHeight) {
                height++;
                doneExpanding = false;
            }
            if (width > maxWidth)
                width--;
            if (height > maxHeight)
                height--;
        }

    } else {
        for (int i = 0; i < ANIMATED_STAT_SPEED; i++) {
            if (width > minWidth)
                width--;
            if (height > minHeight)
                height--;
        }
        doneExpanding = false;
    }

    affectedY = baseY;
    if (affectingStat != null) {
        affectedY += affectingStat.affectedY + affectingStat.height;
    }
    if (leftSided)
        width *= -1;
    Gui.drawRect(baseX, affectedY, baseX + width, affectedY + height, backGroundColor);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(3.0F);
    GL11.glColor4d(0, 0, 0, 1);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINE_LOOP);
    tess.addVertex(baseX, affectedY, zLevel);
    tess.addVertex(baseX + width, affectedY, zLevel);
    tess.addVertex(baseX + width, affectedY + height, zLevel);
    tess.addVertex(baseX, affectedY + height, zLevel);
    tess.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    if (leftSided)
        width *= -1;
    // if done expanding, draw the information
    if (doneExpanding) {
        fontRenderer.drawStringWithShadow(title, baseX + (leftSided ? -width + 2 : 18), affectedY + 2,
                0xFFFF00);
        for (int i = 0; i < textList.size(); i++) {
            if (textList.get(i).contains("\u00a70")) {
                fontRenderer.drawString(textList.get(i), baseX + (leftSided ? -width + 2 : 18),
                        affectedY + i * 10 + 12, 0xFFFFFF);
            } else {
                fontRenderer.drawStringWithShadow(textList.get(i), baseX + (leftSided ? -width + 2 : 18),
                        affectedY + i * 10 + 12, 0xFFFFFF);
            }
        }

    }
}

From source file:net.quetzi.bluepower.client.gui.widget.BaseWidget.java

License:Open Source License

@Override
public void render(int mouseX, int mouseY) {

    GL11.glColor4d(1, 1, 1, 1);
    if (textures.length > 0)
        Minecraft.getMinecraft().getTextureManager().bindTexture(textures[textureIndex]);
    Gui.func_146110_a(x, y, getTextureU(), getTextureV(), width, height, getTextureWidth(), getTextureHeight());
}

From source file:net.quetzi.bluepower.compat.fmp.MultipartBPPart.java

License:Open Source License

@Override
public boolean drawHighlight(MovingObjectPosition mop, EntityPlayer player, float frame) {

    ForgeDirection face = ForgeDirection.getOrientation(mop.sideHit);

    AxisAlignedBB c = net.quetzi.bluepower.util.RayTracer.getSelectedCuboid(mop, player, face, getSubParts(),
            true);//  w w  w  .jav  a 2 s .c  o m

    if (c == null)
        return true;

    GL11.glPushMatrix();
    {
        GL11.glTranslated(x() - TileEntityRendererDispatcher.staticPlayerX,
                y() - TileEntityRendererDispatcher.staticPlayerY,
                z() - TileEntityRendererDispatcher.staticPlayerZ);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glColor4d(0, 0, 0, 0);
        RenderUtils.drawCuboidOutline(new Cuboid6(c).expand(0.001));
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    GL11.glPopMatrix();

    return true;
}

From source file:net.wurstclient.features.mods.BowAimbotMod.java

License:Open Source License

@Override
public void onRender(float partialTicks) {
    if (target == null)
        return;//from  w w  w .j a v a  2  s  .  co m

    // GL settings
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glLineWidth(2);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glPushMatrix();
    GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY,
            -mc.getRenderManager().renderPosZ);

    // set position
    GL11.glTranslated(target.posX, target.posY, target.posZ);

    // set size
    double boxWidth = target.width + 0.1;
    double boxHeight = target.height + 0.1;
    GL11.glScaled(boxWidth, boxHeight, boxWidth);

    // move to center
    GL11.glTranslated(0, 0.5, 0);

    double v = 1 / velocity;
    GL11.glScaled(v, v, v);

    // draw outline
    GL11.glColor4d(1, 0, 0, 0.5F * velocity);
    RenderUtils.drawOutlinedBox(TARGET_BOX);

    // draw box
    GL11.glColor4d(1, 0, 0, 0.25F * velocity);
    RenderUtils.drawSolidBox(TARGET_BOX);

    GL11.glPopMatrix();

    // GL resets
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:org.cogaen.lwjgl.scene.Color.java

License:Open Source License

public void apply() {
    GL11.glColor4d(this.red, this.green, this.blue, this.alpha);
}

From source file:org.cogaen.lwjgl.scene.SceneService.java

License:Open Source License

public void renderScene() {

    // quite and dirty frame counter
    this.clock.tick();
    this.fpsSum += this.clock.getDelta();
    if (++this.fpsCnt >= this.fpsAvg) {
        this.fpsCnt = 0;
        this.fps = String.format("FPS: %2.2f", (1.0 / (this.fpsSum / this.fpsAvg)));
        this.fpsSum = 0.0;
    }//from ww  w.  j a  v  a  2s.c  om

    // Clear the screen and depth buffer
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    // render layers in each camera
    for (Camera camera : cameras) {
        if (!camera.isActive()) {
            continue;
        }

        camera.applyTransform();
        for (int i = this.layers.size() - 1; i >= 0; --i) {
            this.layers.get(i).render(camera.getMask());
        }

        for (RenderSubsystem rs : this.subSystems) {
            rs.render(camera.getMask());
        }
    }

    // draw overlays
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 1.0, 0, 1.0 / getAspectRatio(), 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glViewport(0, 0, this.config.getWidth(), this.config.getHeight());

    this.overlayRoot.renderWithAspectRatio(0xFFFFFFFF, getAspectRatio());
    //      this.overlayRoot.render(0xFFFFFFFF);

    // render frame counter
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, this.config.getWidth(), this.config.getHeight(), 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(1, 0, 1, 1);
    font.drawString(5, this.config.getHeight() - 20, this.fps);

    Display.update();

    if (Display.isCloseRequested()) {
        this.evtSrv.dispatchEvent(new SimpleEvent(WINDOW_CLOSE_REQUEST));
    }
}