Example usage for org.lwjgl.opengl GL11 glPopMatrix

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

Introduction

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

Prototype

public static native void glPopMatrix();

Source Link

Document

Pops the top entry off the current matrix stack, replacing the current matrix with the matrix that was the second entry in the stack.

Usage

From source file:cn.academy.core.client.component.Glow.java

License:GNU General Public License

public Glow() {
    super("Glow");

    listen(FrameEvent.class, (w, event) -> {
        if (!writeDepth)
            GL11.glDepthMask(false);//ww  w.j a va2s  .  c  om
        GL11.glPushMatrix();
        GL11.glTranslated(0, 0, zLevel);
        ACRenderingHelper.drawGlow(0, 0, w.transform.width, w.transform.height, glowSize, color);
        GL11.glPopMatrix();
        GL11.glDepthMask(true);
    });
}

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

License:Open Source License

@Override
public void draw(double mx, double my, boolean hover) {
    super.draw(mx, my, hover);
    GL11.glPushMatrix();// w  ww.j a  v  a  2  s .c  o  m
    {
        RenderUtils.bindColor(base.DEFAULT_COLOR);
        //Machine stat
        ACUtils.drawText(ACLangs.machineStat(), 6, 100.5, 7.5);

        //Current Energy
        ACUtils.drawText(String.format("%s: %.0f/%.0f EU", ACLangs.curEnergy(), base.dev.curEnergy,
                base.dev.getMaxEnergy()), 6, 121, 6);
        //Sync Rate
        ACUtils.drawText(String.format("%s: %.2f%%", ACLangs.devSyncRate(), base.dev.getSyncRateForDisplay()),
                6, 130, 6);
        RenderUtils.bindIdentity();

        //Numeric indication
        if (isFirst || !isMaxLevel) {
            RenderUtils.bindColor(base.DEFAULT_COLOR);
            ACUtils.drawText(ACLangs.expConsumption(), 56, 50, 5.6);

            Pair<Integer, Double> exp = base.dev.getExpectation(ida, base.data);

            RenderUtils.bindColor(base.EXP_INDI_COLOR);
            ACUtils.drawText(String.format("%d", exp.first), 70, 59, 5.8F);

            RenderUtils.bindColor(base.EU_INDI_COLOR);
            ACUtils.drawText(String.format("%.0f", exp.second), 70, 67, 5.8F);

            RenderUtils.loadTexture(TEXTURE);
            RenderUtils.bindIdentity();
            HudUtils.drawRect(57, 61, 374, 26, 8.5, 12, 17, 24);
        }
    }
    GL11.glPopMatrix();

    RenderUtils.loadTexture(TEXTURE);
}

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

License:Open Source License

@Override
public void draw(double mx, double my, boolean mouseHovering) {
    // Background
    GL11.glEnable(GL11.GL_BLEND);/*from  www.  ja  v a2 s  .  c o m*/
    super.draw(mx, my, mouseHovering);

    //Player
    GL11.glPushMatrix();
    {
        drawPlayer();
    }
    GL11.glPopMatrix();
    GL11.glColor4f(1, 1, 1, 1);

    // Page name
    String pname = dev.getCurPage().getDisplayName();
    RenderUtils.bindColor(dev.DEFAULT_COLOR);
    ACUtils.drawText(pname, 156, 4.5, 8.5, Align.CENTER);

    //Titles
    ACUtils.drawText(ACLangs.holoView(), 147, 20.5, 7.5);

    ACUtils.drawText(ACLangs.ad_UserInfo(), 147.5, 119, 7.5);

    //Misc
    drawUserInfo();
}

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

License:Open Source License

private void drawPlayer() {
    EntityPlayer player = dev.user;//  w w  w. ja va  2 s .c om
    RenderUtils.loadTexture(RenderUtils.STEVE_TEXTURE);
    float x = 100, y = 100, scale = 2.1F;
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef(183, 58, 100F);
        GL11.glScalef((-scale), scale, scale);
        GL11.glRotated(-25, 1, 0, 0);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(Minecraft.getSystemTime() / 100F, 0F, 1F, 0F); //Rotate around Y
        model.render(player, 0, 0, 0, 0, 0, 1F);
    }
    GL11.glPopMatrix();
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
}

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);// w  ww.jav a 2  s  .  co  m
    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 w  w .ja  va  2 s  .co  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

@Override
public void draw(ScaledResolution sr) {
    int h = sr.getScaledHeight(), w = sr.getScaledWidth();
    GL11.glEnable(GL11.GL_BLEND);//from   ww w .  j a  v a  2s  . com
    GL11.glPushMatrix();
    {
        float x0 = w / 2F, y0 = h / 2F, scale = 0.32F;
        GL11.glTranslated(0, -5, 0);
        GL11.glTranslatef(x0, y0, 0);
        GL11.glScalef(scale, scale, 1);

        HudUtils.setTextureResolution(768, 512);
        RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET);
        long dt = Minecraft.getSystemTime() - lastOpenTime;
        drawSelectionMenu(w, h, dt);
        drawPresetInfo(w, h, dt);
        drawTag(w, h, dt);
    }
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}

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;/*  w  ww . ja v  a 2  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);//from  ww w.  ja  va  2 s. c  o m
    GL11.glPushMatrix();
    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.render.ACModelBiped.java

License:Open Source License

@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
    GL11.glPushMatrix();/*w  w  w . j ava  2  s .c om*/
    {
        if (par1Entity == Minecraft.getMinecraft().thePlayer) {
            GL11.glPopMatrix();
            return;
        }
        //System.out.println(DebugUtils.formatArray(par2, par3, par4, par5, par6, par7));
        GL11.glTranslated(0, 1, 0);
        GL11.glRotated(180, 0, 1, 0);
        GL11.glRotated(90, 1, 0, 0);
        GL11.glRotated(180, 0, 1, 0);
        super.render(par1Entity, par2, par3, par4, par5, par6, par7);
    }
    GL11.glPopMatrix();
}