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.ethylamine.fsynthesis.client.renderer.tileentity.DisintegraterTESR.java

License:Open Source License

private void renderDisintegrater(TileEntityDisintegrater te) {

    final int x = te.xCoord;
    final int y = te.yCoord;
    final int z = te.zCoord;
    final World world = te.getWorldObj();

    // Lighting// w w w  . j a  v a2s .c o  m
    final float brightness = ModBlocks.disintegrater.getMixedBrightnessForBlock(world, x, y, z);
    final int skyLight = world.getLightBrightnessForSkyBlocks(x, y, z, 0);
    final int skyLightLSB = skyLight % 65536;
    final int skyLightMSB = skyLight / 65536;

    Tessellator.instance.setColorOpaque_F(brightness, brightness, brightness);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyLightLSB, skyLightMSB);

    // Open Render buffer
    GL11.glPushMatrix();

    // Inherent adjustments to model
    GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right);
    GL11.glTranslatef(OFFSET.left, OFFSET.middle, OFFSET.right);

    // Orient the model to match the placement
    final int metadata = world.getBlockMetadata(x, y, z);
    final Orientation orientation = Orientation.getdecodedOrientation(metadata);

    GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, 1.0F, 0.0F);

    // Bind the texture
    bindTexture(TEXTURE);

    // Render
    model.render();

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

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

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    if (tileEntity instanceof TungstenChestTE) {
        final TungstenChestTE te = (TungstenChestTE) tileEntity;

        // Open Render buffer
        GL11.glPushMatrix();//  w ww . j  ava2s. com

        // Position Renderer
        //noinspection NumericCastThatLosesPrecision
        GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);

        renderTungstenChest(te, tick);

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

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

License:Open Source License

private void renderTungstenChest(TungstenChestTE te, float tick) {
    final int x = te.xCoord;
    final int y = te.yCoord;
    final int z = te.zCoord;
    final World world = te.getWorldObj();

    GL11.glPushMatrix();//from  ww  w  . jav a  2  s  . co m

    // Position Renderer
    bindTexture(TEXTURE);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(1.0F, -1.0F, -1.0F); //flip & rotate
    GL11.glTranslatef(0.5F, 0.5F, 0.5F); //translate block pos around fromBLK ORG

    final int metadata = world.getBlockMetadata(x, y, z);
    final Orientation orientation = Orientation.getdecodedOrientation(metadata);
    GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, -1.0F, 0.0F);

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F); //translate BLK ORG to block pos

    //lid angle.
    float adjLDAngle = te.getPrevLidAngle() + (te.getLidAngle() - te.getPrevLidAngle()) * tick;
    adjLDAngle = 1.0F - adjLDAngle;
    adjLDAngle = 1.0F - adjLDAngle * adjLDAngle * adjLDAngle;
    //noinspection NumericCastThatLosesPrecision
    vanillaChest.chestLid.rotateAngleX = -(adjLDAngle * (float) Math.PI / 2.0F);

    vanillaChest.renderAll();

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java

public void renderPistonBase(ResourceLocation framemap) {
    GL11.glPushMatrix();/*from w w w.ja va  2 s  .  c o  m*/
    this.bindTexture(framemap);
    modelpiston.renderPart("innerframe");
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    this.bindTexture(this.pistonmap);
    modelpiston.renderPart("shaft");
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    this.bindTexture(framemap);
    modelpiston.renderPart("outterframe");
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    this.bindTexture(this.pistonmap);
    modelpiston.renderPart("pistonbase");
    GL11.glPopMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java

@Override
public void renderTileEntityAt(TileEntity ti, double x, double y, double z, float timeSinceLastTick) {
    TileFramePiston tile = (TileFramePiston) ti;
    ResourceLocation framemap = super.getFrame(tile.getMaterialType());
    GL11.glDisable(GL11.GL_CULL_FACE);// ww w.  j ava 2 s .  c  om

    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(scale, scale, scale);

    double[] dir = this.directionRotate(tile.getFace());
    GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);

    this.renderPistonBase(framemap);

    if (tile.isStill()) {
        GL11.glPushMatrix();
        this.bindTexture(this.pistonmap);
        modelpiston.renderPart("pistsontop");
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    } else {
        GL11.glPopMatrix();
        GL11.glPushMatrix();

        this.TranslateModel(x, y, z, tile.getFace(), tile.getProgress());

        GL11.glScaled(scale, scale, scale);
        GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);

        GL11.glPushMatrix();
        this.bindTexture(framemap);
        this.modelpistonext.renderPart("outterframe");
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        this.bindTexture(framemap);
        this.modelpistonext.renderPart("innerframe");
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        this.bindTexture(pistonmap);
        this.modelpistonext.renderPart("shaft");
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        this.bindTexture(pistonmap);
        this.modelpistonext.renderPart("face");
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }

}

From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    //RenderBlocks render = (RenderBlocks) data[0];
    GL11.glDisable(GL11.GL_CULL_FACE);/*from  ww  w . j a va 2  s  . c  o m*/
    GL11.glPushMatrix();
    GL11.glScaled(scale, scale, scale);
    double[] dir = this.directionRotate(1);
    GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);
    this.renderPistonBase(this.frametextures
            .get(item.hasTagCompound() ? item.getTagCompound().getString("frame_material") : "wood"));

    GL11.glPushMatrix();
    this.bindTexture(this.pistonmap);
    modelpiston.renderPart("pistsontop");
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FrameTranslaterRenderer.java

private void renderTranslater(ResourceLocation framemap) {
    GL11.glPushMatrix();//w  w  w. j  av a2  s  .c  om
    this.bindTexture(framemap);
    modelpiston.renderPart("innerframe");
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    this.bindTexture(this.fieldtexture);
    modelpiston.renderPart("top");
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    this.bindTexture(framemap);
    modelpiston.renderPart("outterframe");
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    this.bindTexture(this.fieldtexture);
    modelpiston.renderPart("machine");
    GL11.glPopMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FrameTranslaterRenderer.java

@Override
public void renderTileEntityAt(TileEntity ti, double x, double y, double z, float timesincelasttick) {
    TileFrameTranslater tile = (TileFrameTranslater) ti;
    ResourceLocation framemap = super.getFrame(tile.getMaterialType());
    GL11.glDisable(GL11.GL_CULL_FACE);/*from   www.j a v  a  2  s. c  o  m*/
    GL11.glColor3d(1.0, 1.0, 1.0);
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(scale, scale, scale);
    double[] dir = this.directionRotate(tile.getFace());
    GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);
    this.renderTranslater(framemap);
    GL11.glPopMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FrameTranslaterRenderer.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glDisable(GL11.GL_CULL_FACE);/*from   w  w w.j ava  2s .c om*/
    GL11.glPushMatrix();
    GL11.glScaled(scale, scale, scale);
    this.renderTranslater(
            super.getFrame(item.hasTagCompound() ? item.getTagCompound().getString("frame_material") : "wood"));
    GL11.glPopMatrix();
}

From source file:com.fireball1725.firecore.client.gui.GuiBase.java

License:Open Source License

public void drawTooltip(int mouseX, int mouseY, int forceWidth, String message) {
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    int[][] savedGLState = OpenGLHelper.saveGLState(new int[] { GL11.GL_ALPHA_TEST, GL11.GL_LIGHTING });

    GL11.glPushMatrix();/*from   w  w w  .j av a2s .c om*/

    guiHelper.drawWindowWithBorder(mouseX, mouseY, forceWidth, 10, colorBackground, colorBorder);
    guiHelper.drawCenteredStringWithShadow(mouseX, mouseY, forceWidth, "Hello World", colorFont);

    GL11.glPopMatrix();

    OpenGLHelper.restoreGLState(savedGLState);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}