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:cn.academy.core.client.gui.dev.DialogueBase.java

License:Open Source License

private static void drawButtonFrame() {
    GL11.glColor4d(1, 1, 1, 0.3);
    RenderUtils.loadTexture(TEXTURE);//from w w w. j  a v a  2 s . c o m
    HudUtils.drawRect(-1.5, -.5, 410, 1, 26.5, 8.5, 53, 19);
    GL11.glColor4d(1, 1, 1, 1);
}

From source file:cn.academy.core.client.gui.dev.DialogueBase.java

License:Open Source License

@Override
public void draw(double mx, double my, boolean mouseHovering) {
    super.draw(mx, my, mouseHovering);
    RenderUtils.bindColor(dev.DEFAULT_COLOR);
    ACUtils.drawText(title, 2.5, 2.4, 6);
    GL11.glColor4d(1, 1, 1, 1);
}

From source file:cn.academy.core.client.gui.dev.PageSkills.java

License:Open Source License

@Override
public void draw(double mx, double my, boolean hover) {
    super.draw(mx, my, hover);
    //sync rate/* ww w.j a va2 s. c  o  m*/
    String str = String.format("%s: %.2f%%", ACLangs.devSyncRate(), base.dev.getSyncRateForDisplay());
    RenderUtils.bindColor(base.DEFAULT_COLOR);
    ACUtils.drawText(str, 5, 135, 5.5);
    GL11.glColor4d(1, 1, 1, 1);
}

From source file:cn.academy.core.client.gui.GuiMainScreen.java

License:Open Source License

@Override
public void draw(ScaledResolution sr) {
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    AbilityData data = AbilityDataMain.getData(player);
    double w = sr.getScaledWidth_double(), h = sr.getScaledHeight_double();
    double size = 80.0, x = w - 80, y = h - 65;
    boolean active = EventHandlerClient.isSkillEnabled();
    long time = Minecraft.getSystemTime();

    GL11.glEnable(GL11.GL_BLEND);//ww w  .  j  a  va2s  . c om
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {
        GL11.glPushMatrix();
        { //Logo rendering
            double scale = .25;
            double mAlpha = active ? 0.8 : 0.4;
            HudUtils.setTextureResolution(256, 256);

            GL11.glTranslated(w - 80, h - 70, 0);
            GL11.glScaled(scale, scale, 1);

            GL11.glColor4d(1, 1, 1, mAlpha);
            logoBack.draw();

            GL11.glColor4d(1, 1, 1, (mAlpha * 1.25) * (0.7 + Math.sin(time / 900D) * 0.3));
            logoRays.draw();

            GL11.glColor4d(1, 1, 1, mAlpha);
            logoBack.draw();
            logoFrame.draw();

            RenderUtils.loadTexture(data.getCategory().getLogo());
            HudUtils.drawRect(63, 63, 129, 129);

            logoGeom.getTransform().setRoll(time / 1000D);
            logoGeom.draw();
        }
        GL11.glPopMatrix();
        RenderUtils.bindIdentity();

        //CPBar rendering
        if (active) {
            lastActiveTime = time;
        } else {
            lastInactiveTime = time;
        }
        double mAlpha = active ? Math.min((time - lastInactiveTime) / 300D, 1.0)
                : Math.max((300 + lastActiveTime - time) / 300D, 0.0);

        if (mAlpha > 0) {
            //Cooldown
            drawCooldownBars(data, mAlpha, w, h);

            GL11.glColor4d(1, 1, 1, mAlpha * 0.6);
            RenderUtils.loadTexture(ACClientProps.TEX_HUD_BAR);
            HudUtils.setTextureResolution(512, 200);
            double scale = .4;
            GL11.glTranslated(w - 193, 17, 0);
            GL11.glScaled(scale, scale, 0);
            //Back
            HudUtils.drawRect(0, 0, 0, 73, 455, 127, 455, 127);

            //CPBar
            double prog = data.getCurrentCP() / data.getMaxCP();
            int[] cs = data.getCategory().getColorStyle();
            RenderUtils.bindColor(cs[0], cs[1], cs[2], (int) (mAlpha * 255));
            HudUtils.drawRect(439 - 436 * prog, 3, 439 - 436 * prog, 4, 436 * prog, 28, 436 * prog, 28);

            //CPBar glow
            double alpha = Math.max(0, (prog - 0.6) / 0.4);
            GL11.glColor4d(1, 1, 1, alpha * mAlpha);
            HudUtils.drawRect(3, 3, 3, 42, 436, 28, 436, 28);

            //Chip
            HudUtils.drawRect(269, 46, 478, 40, 26, 26, 26, 26);
            alpha = 0.5 + 0.5 * Math.sin(Minecraft.getSystemTime() / 500D);
            RenderUtils.bindColor(cs[0], cs[1], cs[2], (int) (alpha * mAlpha * 255)); //Chip glow light
            HudUtils.drawRect(266, 45, 474, 5, 32, 32, 32, 32);

            //Level
            GL11.glColor4d(1, 1, 1, mAlpha * .6);
            ACClientProps.FONT_YAHEI_32.drawAdjusted(data.getLevel().getDisplayName(), 184, 58, 20, 69);

            //Numeric CP
            String str = String.format("%.0f/%.0f", data.getCurrentCP(), data.getMaxCP());
            font.drawAdjusted(str, 316, 87, 22, Align.CENTER, 167);
        }
    }
    GL11.glPopMatrix();
    RenderUtils.bindIdentity();
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.academy.core.client.gui.GuiMainScreen.java

License:Open Source License

private void drawCooldownBars(AbilityData data, double mAlpha, double w, double h) {
    final double len = 100;
    final double fSize = 7, step = 17;

    double y0 = 0;
    Iterator<Map.Entry<Integer, Pair<Integer, Long>>> iter = aliveCooldowns.entrySet().iterator();

    long time = Minecraft.getSystemTime();

    GL11.glPushMatrix();// w ww .  j  a  v a 2 s.  c  o m

    GL11.glTranslated(w - 120, h - 90, 0);

    while (iter.hasNext()) {
        Map.Entry<Integer, Pair<Integer, Long>> ent = iter.next();
        Pair<Integer, Long> dt = ent.getValue();

        SkillBase sb = data.getSkill(ent.getKey());
        if (sb != null) {
            GL11.glColor4d(1, 1, 1, mAlpha);
            String name = sb.getDisplayName();
            double prog = 1 - Math.min(1, (double) (time - dt.second) / dt.first);
            ACUtils.drawText(name, len, y0, fSize, Align.RIGHT);
            GL11.glColor4d(.3, .3, .3, mAlpha);
            HudUtils.drawModalRect(0, y0 + 10, len, 2.3);
            double l = len * prog;
            GL11.glColor4d(.8, .8, .8, mAlpha);
            HudUtils.drawModalRect(len - l, y0 + 10, l, 2.3);
            y0 -= step;
        }

        if (time - dt.second > dt.first) {
            iter.remove();
        }
    }

    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.gui.GuiPresetSelect.java

License:Open Source License

private void drawTag(int w, int h, long dt) {
    double dx = 0;
    double mAlpha;
    mAlpha = Math.min(1.0, dt / 300d);
    final double delta = 30;
    if (dt < 200) {
        dx = delta;/* ww w  .j a v  a2  s.  c  om*/
    } else if (dt < 400) {
        dx = -(delta / 200) * (dt - 200) + delta;
    } else {
        dt = 0;
    }
    GL11.glPushMatrix();
    GL11.glTranslated(dx, 0, 0);
    GL11.glColor4d(1, 1, 1, mAlpha);
    rect(1, -28, 399, 87, 162, 28);
    GL11.glColor4d(.2, .2, .2, mAlpha * .8);
    drawText(ACLangs.presetSelect(), 15, -25, 17);
    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.gui.GuiPresetSelect.java

License:Open Source License

private void drawSelectionMenu(int w, int h, long dt) {
    double ratio = dt < 500 ? 0 : (dt < 600 ? (dt - 500) / 100d : 1.0);
    double mAlpha = dt < 700 ? 0 : Math.min(1.0, (dt - 700) / 300d);
    double textAlpha = dt < 850 ? 0 : Math.min(1.0, (dt - 850) / 300d);

    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPushMatrix();//from   w ww . jav  a 2  s.  c  o m
    GL11.glTranslated(18, 0, 0);
    rect(0, 0, 419, 115, 6, 22 * ratio);

    GL11.glColor4d(1, 1, 1, mAlpha);
    rect(0, 22, 419, 137, 118, 127);

    //draw each text
    final double y_step = 32;
    double y0 = 22;
    GL11.glColor4d(0.3, 0.3, 0.3, mAlpha);
    for (int i = 0; i < 4; ++i) {
        if (curSelection == i) {
            rect(-6, y0, 413, 233, 6, 31);
            GL11.glColor4d(0, 0, 0, mAlpha * 0.2);
            HudUtils.drawModalRect(0, y0, 118, 31);
        }

        GL11.glColor4d(0.3, 0.3, 0.3, mAlpha);
        drawText(ACLangs.presetPrefix() + (i + 1), 10, y0 + 8, 15);
        RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET);
        y0 += y_step;
    }

    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.gui.GuiPresetSelect.java

License:Open Source License

private void drawPresetInfo(int w, int h, long dt) {
    double mAlpha = Math.min(1.0, dt / 300d);
    GL11.glColor4d(1, 1, 1, mAlpha);
    rect(-399, -115, 0, 0, 399, 115);/*  www  . j  av a 2 s .co m*/
    Preset p = PresetManager.getPreset(curSelection);
    AbilityData data = AbilityDataMain.getData(Minecraft.getMinecraft().thePlayer);
    GL11.glColor4d(1, 1, 1, .35);
    for (int i = 0; i < 4; i++) {
        int n = p.getSkillMapping(i);
        if (n != 0) {
            SkillBase sb = data.getSkill(p.getSkillMapping(i));
            ResourceLocation logo = sb.getLogo();
            if (logo != null) {
                RenderUtils.loadTexture(logo);
                HudUtils.drawRect(posArray[i][0] - 399, posArray[i][1] - 115, 69, 69);
            }
        }
    }
    RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET);
}

From source file:cn.academy.core.client.render.ray.RendererRayCylinder.java

License:GNU General Public License

@Override
protected void draw(Entity entity, double len) {
    if (RenderUtils.isInShadowPass())
        return;/*from w  w w  .j  a  v  a2s  .  co  m*/

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glPushMatrix();

    IRay ray = (IRay) entity;

    //HACK: Store the previous alpha
    double oldA = color.a;
    color.a *= ray.getAlpha();

    double width = this.width * ray.getWidth();

    color.bind();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPushMatrix();
    double offset = width * (1 - headFix);
    GL11.glTranslated(offset, 0, 0);
    GL11.glScaled(width * headFix, width, width);
    head.draw(shader);
    GL11.glPopMatrix();

    //Draw the cylinder
    GL11.glPushMatrix();
    GL11.glTranslated(width, 0, 0);
    GL11.glScaled(len - width, width, width);
    cylinder.draw(shader);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(len + width - offset, 0, 0);
    GL11.glScaled(-width * headFix, width, -width);
    head.draw(shader);
    GL11.glPopMatrix();

    GL11.glPopMatrix();

    color.a = oldA;
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glColor4d(1, 1, 1, 1);
}

From source file:cn.academy.core.client.render.SkillRenderManager.java

License:Open Source License

public static void renderThirdPerson(EntityLivingBase ent, ItemStack stack, ItemRenderType type) {
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || !(ent instanceof EntityPlayer))
        return;/*w  ww.  j a v a  2 s.c  om*/
    EntityPlayer player = (EntityPlayer) ent;
    Item item = stack.getItem();
    Block block = Block.getBlockFromItem(stack.getItem());
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {

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

        if (stack.getItemSpriteNumber() == 0 && item instanceof ItemBlock) { //block render routine
            GL11.glTranslated(0, 0, 1.5);
            GL11.glScalef(2F, 2F, 2F);
            GL11.glRotated(45, 1, 0, 1);
            GL11.glRotated(45, 0, 1, 0);
            GL11.glRotated(180, 1, 0, 0);
        } else if (item.isFull3D()) {
            GL11.glTranslated(0.1, 0.8, -.4);
            GL11.glScalef(.8F, .8F, .8F);
            GL11.glRotated(45, 0, 0, -1);
        } else {
            GL11.glTranslated(-.3, 1.2, -.6);
            GL11.glRotatef(90, 1, 0, 0);
            GL11.glScalef(1.5F, 1.5F, 1.5F);
        }

        traverseHandRender(player, HandRenderType.EQUIPPED);

    }
    GL11.glPopMatrix();
}