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:com.builtbroken.atomic.content.machines.processing.extractor.render.RenderItemExtractor.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);/*  ww w .  ja  va2 s  . c  o  m*/
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model_base.renderAll();
    model_drum.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.processing.extractor.render.TESRChemExtractor.java

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaFrame) {
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);

    if (tile instanceof TileEntityChemExtractor) {
        TileEntityChemExtractor entityChemExtractor = (TileEntityChemExtractor) tile;
        ForgeDirection facing = entityChemExtractor.getFacingDirection();

        switch (facing) {
        case NORTH:
            GL11.glRotatef(-90, 0, 1, 0);
            break;
        case SOUTH:
            GL11.glRotatef(90, 0, 1, 0);
            break;
        case EAST:
            GL11.glRotatef(180, 0, 1, 0);
            break;
        case WEST:
            //Good by default
            break;
        }/*  ww w .  j  av  a  2  s . c o m*/

        bindTexture(texture);

        //Render main body
        model_base.renderAll();

        //Render rotating parts
        GL11.glTranslated(-2.5, 1.5, 0);
        float rotation = ((TileEntityChemExtractor) tile).rotate(deltaFrame);
        GL11.glRotatef(rotation, 0, 0, 1);
        model_drum.renderAll();
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.reactor.fission.core.RenderItemReactor.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);/*from   w  w  w.  jav a 2  s  .  c  o  m*/
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.reactor.fission.core.TESRReactorCell.java

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaFrame) {
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);

    if (tile instanceof TileEntityReactorCell) {
        TileEntityReactorCell reactorCell = (TileEntityReactorCell) tile;
        if (reactorCell.isBottom()) {
            bindTexture(bottom_texture);
            bottom_model.renderAll();/*w  w  w . j a v  a 2s.c o m*/
        } else if (reactorCell.isTop()) {
            bindTexture(top_texture);
            top_model.renderAll();
        } else if (reactorCell.isMiddle()) {
            bindTexture(middle_texture);
            middle_model.renderAll();
        } else {
            bindTexture(normal_texture);
            normal_model.renderAll();
        }

        if (reactorCell.shouldRenderFuel()) {
            //TODO render fuel rods
            //TODO decrease in size as fuel is used
            //TODO decrease in color (green -> grey) as its used
            //TODO glow when running (blue or green? hmm)
            //TODO glow molten like if overheating
        }
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.steam.generator.RenderItemSteamGenerator.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -1.1f, -0.5f);
        GL11.glScalef(1.4f, 1.4f, 1.4f);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslatef(0.5f, 0.2f, 0.5f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(0.5f, 0.2f, 0.5f);
    }/*from w  w  w.ja  v a  2  s.  c om*/
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.steam.generator.TESRSteamGenerator.java

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaTick) {
    if (tile instanceof TileEntitySteamGenerator) {
        TileEntitySteamGenerator generator = ((TileEntitySteamGenerator) tile);
        float rotation = generator.rotate(deltaTick);

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

        renderSmallTurbine(rotation);/* ww  w .j a v  a2  s.co m*/

        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.atomic.content.machines.steam.generator.TESRSteamGenerator.java

protected void renderSmallTurbine(float rotation) {
    bindTexture(small_texture);//from  w  ww  .ja va  2s  . co  m

    GL11.glPushMatrix();
    GL11.glRotated(rotation, 0, 1, 0);
    small_model.renderOnly(smallTurbineRenderA);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glRotated(-rotation, 0, 1, 0);
    small_model.renderOnly(smallTurbineRenderB);
    GL11.glPopMatrix();

    small_model.renderAllExcept(smallTurbineRenderAuB); //TODO convert to renderOnly
}

From source file:com.builtbroken.atomic.lib.Render2DHelper.java

/**
 * Used by the overlay to render text with shadow behind the text
 *
 * @param text/*from  ww w.  java2  s  .  c om*/
 * @param x
 * @param y
 * @param colorRGB
 */
public static void renderTextWithShadow(String text, int x, int y, int colorRGB) {
    GL11.glPushMatrix();
    FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
    fontrenderer.drawString(text, x + 1, y, 0);
    fontrenderer.drawString(text, x - 1, y, 0);
    fontrenderer.drawString(text, x, y + 1, 0);
    fontrenderer.drawString(text, x, y - 1, 0);
    fontrenderer.drawString(text, x, y, colorRGB);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glPopMatrix();
}

From source file:com.builtbroken.gascan.content.BucketMaterialCanClient.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

    if (type == ItemRenderType.EQUIPPED) {
        GL11.glRotatef(-40, 0, 1, 0);/*from  w ww. j av a 2  s .  co  m*/
        //GL11.glRotatef(13, 1, 0, 0);
        GL11.glTranslatef(1f, -1.1f, 0.1f);

        final float scale = 0.0625f / 4;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(-90, 0, 1, 0);
        //GL11.glRotatef(-13, 1, 0, 0);
        GL11.glTranslatef(1f, 0.6f, 0.5f);

        final float scale = 0.0625f / 5;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    } else if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0f, 0, 0);

        final float scale = 0.0625f / 4;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.grappling.content.entity.RenderHook.java

@Override
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glDisable(GL11.GL_LIGHTING);/*  w  ww.j a  v  a2  s .  c om*/

    final float scale = 0.0625f / 3;
    GL11.glScalef(scale, scale, scale);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(getEntityTexture(entity));
    if (entity instanceof EntityHook) {
        final Hook hook = ((EntityHook) entity).hook;

        if (hook != null) {
            switch (hook.side) {
            //Bottom
            case 0:
                GL11.glRotatef(-90, 1, 0, 0);
                break;
            //Top
            case 1:
                GL11.glRotatef(90, 1, 0, 0);
                break;
            //North
            case 2:
                //Default rotation
                break;
            //South
            case 3:
                GL11.glRotatef(180, 0, 1, 0);
                break;
            case 4:
                GL11.glRotatef(90, 0, 1, 0);
                break;
            case 5:
                GL11.glRotatef(-90, 0, 1, 0);
                break;
            }
        }
    }
    MODEL.renderAll();

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