Example usage for org.lwjgl.opengl GL11 glPushMatrix

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

Introduction

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

Prototype

public static native void glPushMatrix();

Source Link

Document

Pushes the current matrix stack down by one, duplicating the current matrix in both the top of the stack and the entry below it.

Usage

From source file:appeng.parts.reporting.PartStorageMonitor.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)//  www.ja v a2  s.c om
public void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer) {
    if (this.dspList == null) {
        this.dspList = GLAllocation.generateDisplayLists(1);
    }

    Tessellator tess = Tessellator.instance;

    if ((this.clientFlags & (this.POWERED_FLAG | this.CHANNEL_FLAG)) != (this.POWERED_FLAG
            | this.CHANNEL_FLAG)) {
        return;
    }

    IAEItemStack ais = (IAEItemStack) this.getDisplayed();
    if (ais != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);

        if (this.updateList) {
            this.updateList = false;
            GL11.glNewList(this.dspList, GL11.GL_COMPILE_AND_EXECUTE);
            this.tesrRenderScreen(tess, ais);
            GL11.glEndList();
        } else {
            GL11.glCallList(this.dspList);
        }

        GL11.glPopMatrix();
    }
}

From source file:appeng.parts.reporting.PartStorageMonitor.java

License:Open Source License

private void tesrRenderScreen(Tessellator tess, IAEItemStack ais) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    ForgeDirection d = this.side;
    GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);

    if (d == ForgeDirection.UP) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.spin * 90.0F, 0, 0, 1);
    }/*  w w  w . j  ava2s.c o m*/

    if (d == ForgeDirection.DOWN) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.spin * -90.0F, 0, 0, 1);
    }

    if (d == ForgeDirection.EAST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (d == ForgeDirection.WEST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (d == ForgeDirection.NORTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
    }

    if (d == ForgeDirection.SOUTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    }

    GL11.glPushMatrix();
    try {
        ItemStack sis = ais.getItemStack();
        sis.stackSize = 1;

        int br = 16 << 20 | 16 << 4;
        int var11 = br % 65536;
        int var12 = br / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        // RenderHelper.enableGUIStandardItemLighting();
        tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

        ClientHelper.proxy.doRenderItem(sis, this.tile.getWorldObj());
    } catch (Exception e) {
        AELog.error(e);
    }

    GL11.glPopMatrix();

    GL11.glTranslatef(0.0f, 0.14f, -0.24f);
    GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f);

    final long stackSize = ais.getStackSize();
    final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize);

    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    int width = fr.getStringWidth(renderedStackSize);
    GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
    fr.drawString(renderedStackSize, 0, 0, 0);

    GL11.glPopAttrib();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderHolyKeyStone.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glEnable(GL11.GL_BLEND);/*from w w w .ja v a  2s.  c  o m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glRotatef(-5F, 1F, 0F, 0F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityHolyKeyStone(), 0.0D, 0.0D, 0.0D,
            0.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderHolyStone.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glEnable(GL11.GL_BLEND);//  w w w.j  a  va2 s .co m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    float s = 1.4F;
    GL11.glScalef(s, s, s);
    GL11.glRotatef(-5F, 1F, 0F, 0F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityHolyStone(), 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderMomijiShield.java

License:Open Source License

private void render(Entity entity) {
    float limbSwing = 0F;
    float limbSwingAmount = 0F;
    float age = 0F;

    if (entity instanceof EntityLivingBase) {
        EntityLivingBase livingBase = (EntityLivingBase) entity;
        limbSwing = livingBase.limbSwing;
        limbSwingAmount = livingBase.limbSwingAmount;
        age = livingBase.getAge();/*  w w w.  j a  va 2 s.com*/
    }

    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
    GL11.glRotatef(60F, 0F, 0F, 1F);
    GL11.glTranslatef(0.5F, -0.5F, -0.2F);
    MODEL.render(entity, limbSwing, limbSwingAmount, age, entity.getRotationYawHead(), entity.rotationPitch,
            0.0625F);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderOnbashira.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glTranslatef(0F, -0.7F, -0.5F);
    GL11.glEnable(GL11.GL_BLEND);/*from  w ww.  j  av a2  s .  com*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    float s = 0.5F;
    GL11.glScalef(s, s, s);
    GL11.glRotatef(0F, 0F, 0F, 0F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityOnbashira(), 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.LargeItemRenderer.java

License:Open Source License

private void doTheStuff(ItemStack stack, EntityLivingBase entity, boolean view) {
    GL11.glPushMatrix();
    double size = scale;
    if (view) {/* w ww .  j  ava 2s  .  c o  m*/
        size *= 1.75F;
        GL11.glTranslated(-0.35F * scale, -0.125F * scale, 0.0F);
    } else {
        size *= (entity instanceof EntityPlayer ? 2.0F : 1.75F);
        GL11.glTranslated(1.0D - size, -0.125D * scale, 0.05D * scale);
        if (rotate != 0) {
            GL11.glTranslated(2.0D - size, -2.125D * scale, 0.05D * scale);
            GL11.glTranslatef(0, 4, 0);
            GL11.glTranslated(1.2, -2, -0.1);
        }
    }
    GL11.glScaled(size, size, size);
    IIcon icon = stack.getItem().getIcon(stack, 0);
    Tessellator tessellator = Tessellator.instance;
    ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
            icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.RenderHolyKeyStone.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.4F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0f, 1f);/*  w ww.  j  a  v a2 s  . c  o  m*/
    bindTexture(TEXTURE);
    MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.RenderHolyStone.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0f, 1f);//from   w ww.  j  a  v  a  2 s.  com
    bindTexture(TEXTURE);
    GL11.glPushMatrix();
    MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.RenderOnbashira.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0f, 1f);/*from www  .  ja v a 2 s. c  om*/
    bindTexture(TEXTURE);
    MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
    GL11.glPopMatrix();
}