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:boilerplate.client.renderers.block.RenderMinedBlock.java

License:Minecraft Mod Public

public void doRender(EntityMinedBlock entBlock, double posX, double posY, double posZ, float f,
        float renderTick) {
    World world = entBlock.getWorldObj();
    Block block = entBlock.getBlock();/*from  w w w . jav a 2 s .c  o  m*/

    MathHelper.floor_double(entBlock.posX);
    MathHelper.floor_double(entBlock.posY);
    MathHelper.floor_double(entBlock.posZ);

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glPushMatrix();
    GL11.glTranslatef((float) posX, (float) posY, (float) posZ);
    this.bindEntityTexture(entBlock);

    float scale = entBlock.scale;
    float rot = world.getWorldTime() * 17.6F;

    GL11.glScalef(scale, scale, scale);

    if (entBlock.doesRotate)
        GL11.glRotatef(rot, 0 - world.rand.nextFloat(), 0 - world.rand.nextFloat(), 0 - world.rand.nextFloat());

    this.blockRenderer.blockAccess = entBlock.worldObj;
    this.blockRenderer.useInventoryTint = true;

    this.blockRenderer.setRenderBoundsFromBlock(block);
    this.blockRenderer.renderBlockAsItem(block, entBlock.metadata, 1.0F);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:buildcraft.builders.render.RenderArchitect.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileArchitect architect = (TileArchitect) tileentity;

    GL11.glPushMatrix();/*from  w  w w  .ja  v  a2  s.  com*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

    for (LaserData laser : architect.subLasers) {
        if (laser != null) {
            GL11.glPushMatrix();
            RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                    EntityLaser.LASER_TEXTURES[3]);

            GL11.glPopMatrix();
        }
    }

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

From source file:buildcraft.builders.render.RenderConstructionMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileConstructionMarker marker = (TileConstructionMarker) tileentity;

    GL11.glPushMatrix();/*from   www . j  ava 2 s .co m*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

    if (marker.laser != null) {
        GL11.glPushMatrix();
        RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, marker.laser,
                EntityLaser.LASER_TEXTURES[4]);
        GL11.glPopMatrix();
    }

    if (marker.itemBlueprint != null) {
        doRenderItem(marker.itemBlueprint, marker.xCoord + 0.5F, marker.yCoord + 0.2F, marker.zCoord + 0.5F);
    }

    //GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopAttrib();
    GL11.glPopMatrix();

    renderItems.render(tileentity, x, y, z);
}

From source file:buildcraft.builders.render.RenderConstructionMarker.java

License:Minecraft Mod Public

public void doRenderItem(ItemStack stack, double x, double y, double z) {
    if (stack == null) {
        return;/*from ww w  .j  a  v a 2  s .  c  o  m*/
    }

    float renderScale = 1.5f;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glTranslatef(0, 0.25F, 0);
    GL11.glScalef(renderScale, renderScale, renderScale);
    dummyEntityItem.setEntityItemStack(stack);
    customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);

    GL11.glPopMatrix();
}

From source file:buildcraft.builders.RenderArchitect.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileArchitect architect = (TileArchitect) tileentity;

    if (architect != null) {
        GL11.glPushMatrix();/*from   ww w . ja  v  a 2  s .c  om*/
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        for (LaserData laser : architect.subLasers) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                        EntityLaser.LASER_TEXTURES[3]);

                GL11.glPopMatrix();
            }
        }

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

From source file:buildcraft.builders.RenderBuilder.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileAbstractBuilder builder = (TileAbstractBuilder) tileentity;

    if (builder != null) {
        GL11.glPushMatrix();//from   w w w . ja v a 2  s  .c o  m
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        if (builder.getPathLaser() != null) {
            for (LaserData laser : builder.getPathLaser()) {
                if (laser != null) {
                    GL11.glPushMatrix();
                    RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                            EntityLaser.LASER_TEXTURES[4]);
                    GL11.glPopMatrix();
                }
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }

    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

    if (builder.getBuilders() != null) {
        for (BuildingItem i : builder.getBuilders()) {
            doRenderItem(i, 1.0F);
        }
    }

    GL11.glPopMatrix();
}

From source file:buildcraft.builders.RenderBuilder.java

License:Minecraft Mod Public

public void doRenderItem(BuildingItem i, float light) {
    if (i == null) {
        return;//from   ww  w .j  a  v  a 2  s.c o  m
    }

    i.displayUpdate();

    for (StackAtPosition s : i.getStacks()) {
        if (s.display) {
            float renderScale = 0.7f;
            GL11.glPushMatrix();
            GL11.glTranslatef((float) s.pos.x, (float) s.pos.y, (float) s.pos.z);
            GL11.glTranslatef(0, 0.25F, 0);
            GL11.glScalef(renderScale, renderScale, renderScale);
            dummyEntityItem.setEntityItemStack(s.stack);
            customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);

            GL11.glPopMatrix();
        }
    }
}

From source file:buildcraft.builders.RenderConstructionMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileConstructionMarker marker = (TileConstructionMarker) tileentity;

    if (marker != null) {
        GL11.glPushMatrix();//from w w w.  j av  a 2 s  . c  o m
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        if (marker.laser != null) {
            GL11.glPushMatrix();
            RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, marker.laser,
                    EntityLaser.LASER_TEXTURES[4]);
            GL11.glPopMatrix();
        }

        if (marker.itemBlueprint != null) {
            doRenderItem(marker.itemBlueprint, marker.xCoord + 0.5F, marker.yCoord + 0.2F,
                    marker.zCoord + 0.5F);
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();

        renderItems.render(tileentity, x, y, z);
    }
}

From source file:buildcraft.builders.RenderPathMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    TilePathMarker marker = (TilePathMarker) tileentity;

    if (marker != null) {
        GL11.glPushMatrix();/*  w w  w .  j  av  a2  s.com*/
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        for (LaserData laser : marker.lasers) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                        EntityLaser.LASER_TEXTURES[3]);
                GL11.glPopMatrix();
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}

From source file:buildcraft.builders.urbanism.RenderBoxProvider.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();/*from   w  w  w .ja va2  s  .  c o  m*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glPushMatrix();
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glTranslated(x, y, z);

    if (tileentity instanceof IBoxesProvider) {
        for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
            if (b.isVisible) {
                RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
            }
        }
    } else if (tileentity instanceof IBoxProvider) {
        Box b = ((IBoxProvider) tileentity).getBox();

        if (b.isVisible) {
            RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
        }
    }

    GL11.glPopMatrix();

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