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:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawLogoutESP(double d, double d1, double d2, double r, double b, double g) {
    GL11.glPushMatrix();/* ww  w .  j a v a 2  s.co  m*/
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1.5F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(1.0F);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(2929);
    GL11.glDepthMask(false);
    GL11.glColor4d(r, g, b, 0.1825F);
    drawBoundingBox(new AxisAlignedBB(d, d1, d2, d + 1.0, d1 + 2.0, d2 + 1.0));
    GL11.glColor4d(r, g, b, 1.0F);
    drawOutlinedBoundingBox(new AxisAlignedBB(d, d1, d2, d + 1.0, d1 + 2.0, d2 + 1.0));
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(2929);
    GL11.glDepthMask(true);
    GL11.glDisable(3042);
    GL11.glPopMatrix();
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawLogoutSpotTracer(LogoutSpot l) {
    try {//from   ww  w  . j  a v  a  2  s .c om
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);

        GL11.glColor3d(l.red, l.green, l.blue);
        GL11.glBegin(GL11.GL_LINE_LOOP);
        GL11.glVertex3d(0, 0, 0);
        GL11.glVertex3d(l.dX + 0.5, l.dY + 0.5, l.dZ + 0.5);
        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    } catch (Exception e) {
    }
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawWayPointTracer(Waypoint w) {
    try {/*  w  ww .j  a va2  s  .c om*/
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glLineWidth(1.5F);
        GL11.glColor3d(w.red, w.green, w.blue);
        GL11.glBegin(GL11.GL_LINE_LOOP);
        Vec3d eyes = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Wrapper.getPlayer().rotationPitch))
                .rotateYaw(-(float) Math.toRadians(Wrapper.getPlayer().rotationYaw));

        GL11.glVertex3d(eyes.xCoord, Wrapper.getPlayer().getEyeHeight() + eyes.yCoord, eyes.zCoord);
        GL11.glVertex3d(w.dX + 0.5, w.dY + 0.5, w.dZ + 0.5);
        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glPopMatrix();
    } catch (Exception e) {
    }
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawEntityESP(Entity entity, Color c) {
    GL11.glPushMatrix();/*www . j a v  a 2s.c  o  m*/
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 0.15F);
    RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
    drawColorBox(
            new AxisAlignedBB(
                    entity.boundingBox.minX - 0.05 - entity.posX + (entity.posX - renderManager.renderPosX),
                    entity.boundingBox.minY - entity.posY + (entity.posY - renderManager.renderPosY),
                    entity.boundingBox.minZ - 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ),
                    entity.boundingBox.maxX + 0.05 - entity.posX + (entity.posX - renderManager.renderPosX),
                    entity.boundingBox.maxY + 0.1 - entity.posY + (entity.posY - renderManager.renderPosY),
                    entity.boundingBox.maxZ + 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ)),
            0F, 0F, 0F, 0F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(
            entity.boundingBox.minX - 0.05 - entity.posX + (entity.posX - renderManager.renderPosX),
            entity.boundingBox.minY - entity.posY + (entity.posY - renderManager.renderPosY),
            entity.boundingBox.minZ - 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ),
            entity.boundingBox.maxX + 0.05 - entity.posX + (entity.posX - renderManager.renderPosX),
            entity.boundingBox.maxY + 0.1 - entity.posY + (entity.posY - renderManager.renderPosY),
            entity.boundingBox.maxZ + 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ)));
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
    GL11.glPopMatrix();
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawPlayerESP(double d, double d1, double d2, EntityPlayer ep, double e, double f) {
    if (!(ep instanceof EntityPlayerSP)) {
        GL11.glPushMatrix();//from  ww w.j  a  v a2s.  c om
        GL11.glEnable(3042);
        if (Wrapper.getFriends().isFriend(ep.getName())) {
            GL11.glColor4f(0.0F, 1F, 0.0F, 0.15F);
        } else {
            GL11.glColor4f(0.7F, 0.0F, 0.0F, 0.15F);
        }
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
        GL11.glLineWidth(1.0F);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        drawBoundingBox(new AxisAlignedBB(d - f, d1 + 0.1, d2 - f, d + f, d1 + e + 0.25, d2 + f));
        if (Wrapper.getFriends().isFriend(ep.getName())) {
            GL11.glColor4f(0.0F, 1F, 0.0F, 1F);
        } else {
            GL11.glColor4f(0.7F, 0.0F, 0.0F, 1F);
        }
        drawOutlinedBoundingBox(new AxisAlignedBB(d - f, d1 + 0.1, d2 - f, d + f, d1 + e + 0.25, d2 + f));
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(3042);
        GL11.glPopMatrix();
    }
}

From source file:com.darkona.adventurebackpack.client.render.CopygirlRenderUtils.java

License:Open Source License

public static void renderItemIn3d(ItemStack stack) {
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    // Not sure why but this can be null when the world loads.
    if (textureManager == null) {
        return;/*from w w w  .j a v  a  2s  . c  o  m*/
    }
    Item item = stack.getItem();

    GL11.glPushMatrix();

    Tessellator tessellator = Tessellator.instance;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.5F, -0.5F, 1 / 32.0F);

    int passes = item.getRenderPasses(stack.getItemDamage());
    for (int pass = 0; pass < passes; pass++) {
        textureManager.bindTexture(((stack.getItemSpriteNumber() == 0) ? TextureMap.locationBlocksTexture
                : TextureMap.locationItemsTexture));
        IIcon icon = item.getIcon(stack, pass);
        if (icon != null) {
            float minU = icon.getMinU();
            float maxU = icon.getMaxU();
            float minV = icon.getMinV();
            float maxV = icon.getMaxV();
            CopygirlRenderUtils.setColorFromInt(item.getColorFromItemStack(stack, pass));
            ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(),
                    icon.getIconHeight(), 0.0625F);
        }
    }

    if (stack.hasEffect(0)) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        textureManager.bindTexture(glint);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);

    GL11.glPopMatrix();
}

From source file:com.dbi.games.fortress.engine.graphics.Sprite.java

public void draw(int x, int y) {
    if (tex == null)
        return;//from   w ww  .ja v a  2s.c  o  m
    GL11.glPushMatrix();

    tex.bind();
    GL11.glTranslatef(x, y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(0, 0);

        GL11.glTexCoord2f(0, 1f);
        GL11.glVertex2f(0, getHeight());

        GL11.glTexCoord2f(1f, 1f);
        GL11.glVertex2f(getWidth(), getHeight());

        GL11.glTexCoord2f(1f, 0);
        GL11.glVertex2f(getWidth(), 0);

    }
    GL11.glEnd();

    GL11.glPopMatrix();
}

From source file:com.dinasgames.engine.graphics.RenderTarget.java

public void popGLStates() {

    //if(true){return;}

    if (activate(true)) {
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();/*  w  w  w  .j a v a2  s  .  c  o m*/
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPopMatrix();
    }

}

From source file:com.dyonovan.tcnodetracker.lib.truetyper.FontHelper.java

License:Open Source License

public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY,
        float rotationZ, float... rgba) {
    Minecraft mc = Minecraft.getMinecraft();
    ScaledResolution sr = new ScaledResolution(mc.getMinecraft(), mc.displayWidth, mc.displayHeight);
    if (mc.gameSettings.hideGUI) {
        return;//from w  ww.  j  a va  2 s  . co m
    }
    int amt = 1;
    if (sr.getScaleFactor() == 1) {
        amt = 2;
    }

    FloatBuffer matrixData = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, matrixData);
    FontHelper.set2DMode(matrixData);
    GL11.glPushMatrix();
    y = mc.displayHeight - (y * sr.getScaleFactor()) - (((font.getLineHeight() / amt)));
    float tx = (x * sr.getScaleFactor()) + (font.getWidth(s) / 2);
    float tranx = tx + 2;
    float trany = y + (font.getLineHeight() / 2);
    GL11.glTranslatef(tranx, trany, 0);
    GL11.glRotatef(rotationZ, 0f, 0f, 1f);
    GL11.glTranslatef(-tranx, -trany, 0);

    GL11.glEnable(GL11.GL_BLEND);
    if (s.contains(formatEscape)) {
        String[] pars = s.split(formatEscape);
        float totalOffset = 0;
        for (int i = 0; i < pars.length; i++) {
            String par = pars[i];
            float[] c = rgba;
            if (i > 0) {
                c = Formatter.getFormatted(par.charAt(0));
                par = par.substring(1, par.length());
            }
            font.drawString((x * sr.getScaleFactor() + totalOffset), y, par, scaleX / amt, scaleY / amt, c);
            totalOffset += font.getWidth(par);
        }
    } else {
        font.drawString((x * sr.getScaleFactor()), y, s, scaleX / amt, scaleY / amt, rgba);
    }
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
    FontHelper.set3DMode();
}

From source file:com.dyonovan.tcnodetracker.lib.truetyper.FontHelper.java

License:Open Source License

private static void set3DMode() {
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();/*from   www  . jav a 2s  .  com*/
    Minecraft mc = Minecraft.getMinecraft();
    mc.entityRenderer.setupOverlayRendering();
}