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.dyonovan.tcnodetracker.lib.truetyper.TrueTypeFont.java

License:Open Source License

public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX,
        float scaleY, int format, float... rgba) {
    if (rgba.length == 0)
        rgba = new float[] { 1f, 1f, 1f, 1f };
    GL11.glPushMatrix();//from w  ww . j  ava2 s  . c  o  m
    GL11.glScalef(scaleX, scaleY, 1.0f);

    FloatObject floatObject = null;
    int charCurrent;

    float totalwidth = 0;
    int i = startIndex, d, c;
    float startY = 0;

    switch (format) {
    case ALIGN_RIGHT: {
        d = -1;
        c = correctR;

        while (i < endIndex) {
            if (whatchars.charAt(i) == '\n')
                startY -= fontHeight;
            i++;
        }
        break;
    }
    case ALIGN_CENTER: {
        for (int l = startIndex; l <= endIndex; l++) {
            charCurrent = whatchars.charAt(l);
            if (charCurrent == '\n')
                break;
            if (charCurrent < 256) {
                floatObject = charArray[charCurrent];
            } else {
                floatObject = (FloatObject) customChars.get(new Character((char) charCurrent));
            }
            totalwidth += floatObject.width - correctL;
        }
        totalwidth /= -2;
    }
    case ALIGN_LEFT:
    default: {
        d = 1;
        c = correctL;
        break;
    }

    }
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID);
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    //   GL11.glBegin(GL11.GL_QUADS);
    if (rgba.length == 4)
        t.setColorRGBA_F(rgba[0], rgba[1], rgba[2], rgba[3]);
    while (i >= startIndex && i <= endIndex) {

        charCurrent = whatchars.charAt(i);
        if (charCurrent < 256) {
            floatObject = charArray[charCurrent];
        } else {
            floatObject = (FloatObject) customChars.get(new Character((char) charCurrent));
        }

        if (floatObject != null) {
            if (d < 0)
                totalwidth += (floatObject.width - c) * d;
            if (charCurrent == '\n') {
                startY -= fontHeight * d;
                totalwidth = 0;
                if (format == ALIGN_CENTER) {
                    for (int l = i + 1; l <= endIndex; l++) {
                        charCurrent = whatchars.charAt(l);
                        if (charCurrent == '\n')
                            break;
                        if (charCurrent < 256) {
                            floatObject = charArray[charCurrent];
                        } else {
                            floatObject = (FloatObject) customChars.get(new Character((char) charCurrent));
                        }
                        totalwidth += floatObject.width - correctL;
                    }
                    totalwidth /= -2;
                }
                //if center get next lines total width/2;
            } else {
                drawQuad((totalwidth + floatObject.width) + x / scaleX, startY + y / scaleY,
                        totalwidth + x / scaleX, (startY + floatObject.height) + y / scaleY,
                        floatObject.storedX + floatObject.width, floatObject.storedY + floatObject.height,
                        floatObject.storedX, floatObject.storedY);
                if (d > 0)
                    totalwidth += (floatObject.width - c) * d;
            }
            i += d;

        }
    }
    t.draw();
    //   GL11.glEnd();

    GL11.glPopMatrix();
}

From source file:com.eagle.adventurersalchemy.model.AlchemicalFireModel.java

License:Open Source License

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    GL11.glPushMatrix();/*from ww  w .  ja  v a2  s. co  m*/
    GL11.glTranslatef(this.frontBorder.offsetX, this.frontBorder.offsetY, this.frontBorder.offsetZ);
    GL11.glTranslatef(this.frontBorder.rotationPointX * f5, this.frontBorder.rotationPointY * f5,
            this.frontBorder.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.8D, 1.0D);
    GL11.glTranslatef(-this.frontBorder.offsetX, -this.frontBorder.offsetY, -this.frontBorder.offsetZ);
    GL11.glTranslatef(-this.frontBorder.rotationPointX * f5, -this.frontBorder.rotationPointY * f5,
            -this.frontBorder.rotationPointZ * f5);
    this.frontBorder.render(f5);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.rightBorder.offsetX, this.rightBorder.offsetY, this.rightBorder.offsetZ);
    GL11.glTranslatef(this.rightBorder.rotationPointX * f5, this.rightBorder.rotationPointY * f5,
            this.rightBorder.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.8D, 1.0D);
    GL11.glTranslatef(-this.rightBorder.offsetX, -this.rightBorder.offsetY, -this.rightBorder.offsetZ);
    GL11.glTranslatef(-this.rightBorder.rotationPointX * f5, -this.rightBorder.rotationPointY * f5,
            -this.rightBorder.rotationPointZ * f5);
    this.rightBorder.render(f5);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.backBorder.offsetX, this.backBorder.offsetY, this.backBorder.offsetZ);
    GL11.glTranslatef(this.backBorder.rotationPointX * f5, this.backBorder.rotationPointY * f5,
            this.backBorder.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.8D, 1.0D);
    GL11.glTranslatef(-this.backBorder.offsetX, -this.backBorder.offsetY, -this.backBorder.offsetZ);
    GL11.glTranslatef(-this.backBorder.rotationPointX * f5, -this.backBorder.rotationPointY * f5,
            -this.backBorder.rotationPointZ * f5);
    this.backBorder.render(f5);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.leftBorder.offsetX, this.leftBorder.offsetY, this.leftBorder.offsetZ);
    GL11.glTranslatef(this.leftBorder.rotationPointX * f5, this.leftBorder.rotationPointY * f5,
            this.leftBorder.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.8D, 1.0D);
    GL11.glTranslatef(-this.leftBorder.offsetX, -this.leftBorder.offsetY, -this.leftBorder.offsetZ);
    GL11.glTranslatef(-this.leftBorder.rotationPointX * f5, -this.leftBorder.rotationPointY * f5,
            -this.leftBorder.rotationPointZ * f5);
    this.leftBorder.render(f5);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.pit.offsetX, this.pit.offsetY, this.pit.offsetZ);
    GL11.glTranslatef(this.pit.rotationPointX * f5, this.pit.rotationPointY * f5, this.pit.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.5D, 1.0D);
    GL11.glTranslatef(-this.pit.offsetX, -this.pit.offsetY, -this.pit.offsetZ);
    GL11.glTranslatef(-this.pit.rotationPointX * f5, -this.pit.rotationPointY * f5,
            -this.pit.rotationPointZ * f5);
    this.pit.render(f5);
    GL11.glPopMatrix();
}

From source file:com.eagle.adventurersalchemy.render.AlchemicalFireItemRender.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    AlchemicalFireModel model = new AlchemicalFireModel();

    GL11.glPushMatrix();//  w  ww  .j  av a2  s .c o  m
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glTranslatef(0.5F, 2.0F, 0.5F);
    } else if (RenderItem.renderInFrame) {
        GL11.glTranslatef(0.0F, 2.4F, 0.0F);
    } else if (type == ItemRenderType.EQUIPPED) {
        GL11.glTranslatef(0.5F, 1.9F, 0.5F);
        GL11.glEnable(GL11.GL_CULL_FACE);
    } else if (type == ItemRenderType.INVENTORY) {
        GL11.glTranslatef(0.5F, 1.7F, 0.5F);
    } else if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0.0F, 1.2F, 0.0F);
    } else {
        GL11.glTranslatef(0.5F, 1.2F, 0.5F);
    }

    Minecraft.getMinecraft().getTextureManager()
            .bindTexture(new ResourceLocation(Dictionary.TEXTURE_ALCHEMICAL_FIRE));

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);

    model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:com.eagle.adventurersalchemy.render.AlchemicalFireRender.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float scale) {
    GL11.glPushMatrix();//  w w w .  j a  va2  s.  co m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    this.bindTexture(modelTexture);

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    this.model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

private void drawPanorama(int par1, int par2, float par3) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();/* w ww  .java 2  s  .c  o m*/
    GL11.glLoadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GL11.glPushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GL11.glTranslatef(f1, f2, f3);
        GL11.glRotatef(MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F,
                0.0F);
        GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();

            if (l == 1) {
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 2) {
                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 3) {
                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 4) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if (l == 5) {
                GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + f4), (double) (0.0F + f4));
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - f4), (double) (0.0F + f4));
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - f4), (double) (1.0F - f4));
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + f4), (double) (1.0F - f4));
            tessellator.draw();
            GL11.glPopMatrix();
        }

        GL11.glPopMatrix();
        GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

/**
 * Draws the screen and all the components in it.
 *///from   ww  w .  ja  va2  s. c  om
public void drawScreen(int par1, int par2, float par3) {
    this.renderSkybox(par1, par2, par3);
    Tessellator tessellator = Tessellator.instance;
    short short1 = 274;
    int k = this.width / 2 - short1 / 2;
    byte b0 = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double) this.updateCounter < 1.0E-4D) {
        this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
        this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
        this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
        this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44);
        this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
    } else {
        this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44);
        this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
    }

    tessellator.setColorOpaque_I(16777215);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
    GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
    float f1 = 1.8F - MathHelper
            .abs(MathHelper.sin((float) (Minecraft.getSystemTime() % 1000L) / 1000.0F * (float) Math.PI * 2.0F)
                    * 0.1F);
    f1 = f1 * 100.0F / (float) (this.fontRenderer.getStringWidth(this.splashText) + 32);
    GL11.glScalef(f1, f1, f1);
    this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 0x8A0868);
    GL11.glPopMatrix();
    String s = "Minecraft 1.6.4";
    this.drawString(this.fontRenderer, s, 2, this.height - (10 + 0 * (this.fontRenderer.FONT_HEIGHT + 1)),
            Color.YELLOW.getRGB());

    if (this.mc.isDemo()) {
        s = s + " Demo";
    }

    String s1 = this.getVersion();
    drawString(this.fontRenderer, s1, this.width - this.fontRenderer.getStringWidth(s1) - 2, this.height - 10,
            0x8A0868);

    if ((this.field_92025_p != null) && (this.field_92025_p.length() > 0)) {
        drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1,
                1428160512);
        drawString(this.fontRenderer, this.field_92025_p, this.field_92022_t, this.field_92021_u, 16777215);
    }

    super.drawScreen(par1, par2, par3);
}

From source file:com.endreman0.souleater.client.gui.GuiInfoBook.java

License:Creative Commons License

@Override
public void drawScreen(int mouseX, int mouseY, float f) {
    drawDefaultBackground();//Dark filter over world, like in inventory and options

    GL11.glPushMatrix();//This starts GL drawing.
    mc.renderEngine.bindTexture(texture);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glScaled(scale, scale, scale);/*from w  w  w  . j ava 2  s .  com*/
    drawTexturedModalRect((int) ((width / 2 - (128 * scale)) * 2 / 3), (int) (height / 2 - (67 * scale)), 0, 0,
            256, 135);
    GL11.glPopMatrix();//Pushing and popping prevents you having to undo all of the translates, rotates and scales

    String[] thisPage = text[2 * page];
    for (int i = 0; i < thisPage.length; i++) {
        fontRendererObj.drawString(thisPage[i],
                x1 + guiWidth / 4 - fontRendererObj.getStringWidth(thisPage[i]) / 2,
                (int) (height * 0.23 + fontRendererObj.FONT_HEIGHT * i), 0x000000, false);
    }
    if (2 * page < lengthPages - 1) {
        thisPage = text[2 * page + 1];
        for (int i = 0; i < thisPage.length; i++) {
            fontRendererObj.drawString(thisPage[i],
                    x1 + guiWidth * 3 / 4 - fontRendererObj.getStringWidth(thisPage[i]) / 2,
                    (int) (height * 0.23 + fontRendererObj.FONT_HEIGHT * i), 0x000000, false);
        }
    }

    super.drawScreen(mouseX, mouseY, f);//Draws buttons and labels
}

From source file:com.ethylamine.fsynthesis.client.renderer.item.DisintegraterItemRenderer.java

License:Open Source License

private void renderCupola(ImmutableTriple<Float, Float, Float> offset) {
    GL11.glPushMatrix();/*from w w w.  ja va 2s .  c om*/
    GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right);
    GL11.glTranslatef(offset.left, offset.middle, offset.right);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(DisintegraterTESR.TEXTURE);

    model.render();

    GL11.glPopMatrix();
}

From source file:com.ethylamine.fsynthesis.client.renderer.item.TungstenChestItemRenderer.java

License:Open Source License

private void renderPlotoniumChest(ImmutableTriple<Float, Float, Float> offset) {
    GL11.glPushMatrix();/* w  ww.j av  a2  s .c  o m*/

    GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right);
    GL11.glTranslatef(offset.left, offset.middle, offset.right);
    GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(90.0f, 0.0f, -1.0f, 0.0f);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TungstenChestTESR.TEXTURE);

    vanillaChest.renderAll();

    GL11.glPopMatrix();
}

From source file:com.ethylamine.fsynthesis.client.renderer.tileentity.DisintegraterTESR.java

License:Open Source License

@SuppressWarnings("NumericCastThatLosesPrecision")
@Override/*from w  w w  .j  av  a 2 s.  c o m*/
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    if (tileEntity instanceof TileEntityDisintegrater) {
        final TileEntityDisintegrater te = (TileEntityDisintegrater) tileEntity;

        // Open Render buffer
        GL11.glPushMatrix();

        // Position Renderer
        GL11.glTranslatef((float) x, (float) y, (float) z);

        renderDisintegrater(te);

        // Close Render Buffer
        GL11.glPopMatrix();
    }
}