Example usage for org.lwjgl.opengl GL11 glTranslatef

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

Introduction

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

Prototype

public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a translation matrix along the x-, y- and z- axes.

Usage

From source file:com.builtbroken.icbm.content.crafting.station.warhead.TileWarheadStationClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glTranslatef(-1f, -1f, 0f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SharedAssets.TOOL_TABLE_TEXTURE);
    SharedAssets.TOOL_TABLE.renderAll(); //TODO render warhead on table, remove some tools
}

From source file:com.builtbroken.icbm.content.fof.TileFoFClient.java

@Override
public void renderDynamic(Pos pos, float frame, int pass) {
    //Render launcher
    GL11.glPushMatrix();// w w w .  j  a va 2  s . co m
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.5f, pos.zf() + 0.5f);
    switch (getDirection()) {
    case EAST:
        break;
    case WEST:
        GL11.glRotatef(180f, 0, 1f, 0);
        break;
    case SOUTH:
        GL11.glRotatef(-90f, 0, 1f, 0);
        break;
    default:
        GL11.glRotatef(90f, 0, 1f, 0);
        break;
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE);
    Assets.FoF_STATION_MODEL.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.fof.TileFoFClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    if (type == IItemRenderer.ItemRenderType.INVENTORY) {
        GL11.glTranslatef(-0.5f, -0.6f, -0.5f);
        GL11.glScaled(.5f, .5f, .5f);/*from  w w w  .java  2 s .  co m*/
    } else if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(150f, 0, 1, 0);
    } else if (type == IItemRenderer.ItemRenderType.EQUIPPED) {
        GL11.glRotatef(150f, 0, 1, 0);
        GL11.glTranslatef(-0.5f, 0.3f, -0.5f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE);
    Assets.FoF_STATION_MODEL.renderAll();
}

From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java

public void doRenderFireBall(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_, float scale) {
    GL11.glPushMatrix();//from   w w w  .  j  a  v a 2 s . com
    this.renderManager.renderEngine.bindTexture(TextureMap.locationItemsTexture);

    GL11.glTranslatef((float) xx, (float) yy, (float) zz);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(scale / 1.0F, scale / 1.0F, scale / 1.0F);

    IIcon iicon = Items.fire_charge.getIconFromDamage(0);
    Tessellator tessellator = Tessellator.instance;

    float minU = iicon.getMinU();
    float maxU = iicon.getMaxU();
    float minV = iicon.getMinV();
    float maxV = iicon.getMaxV();

    float f7 = 1.0F;
    float f8 = 0.5F;
    float f9 = 0.25F;

    GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV((double) (0.0F - f8), (double) (0.0F - f9), 0.0D, (double) minU, (double) maxV);
    tessellator.addVertexWithUV((double) (f7 - f8), (double) (0.0F - f9), 0.0D, (double) maxU, (double) maxV);
    tessellator.addVertexWithUV((double) (f7 - f8), (double) (1.0F - f9), 0.0D, (double) maxU, (double) minV);
    tessellator.addVertexWithUV((double) (0.0F - f8), (double) (1.0F - f9), 0.0D, (double) minU, (double) minV);
    tessellator.draw();

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

From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java

private void doRenderArrow(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_) {
    GL11.glPushMatrix();/*from w  ww  .  jav a 2  s .c  o  m*/
    GL11.glTranslatef((float) xx, (float) yy, (float) zz);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_76986_9_ - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_76986_9_,
            0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (0 + b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();

    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

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

From source file:com.builtbroken.icbm.content.launcher.block.TileLauncherFrame.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glPushMatrix();//from  ww w  .ja  v a2 s  . c  o m
    GL11.glScalef(1f, 1f, 1f);
    GL11.glTranslatef(-0.0F, -0.5F, 0.0F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE);
    Assets.LAUNCHER_FRAME_BLOCK_MODEL.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.block.TileLauncherFrame.java

@SideOnly(Side.CLIENT)
public void renderDynamic(Pos pos, float frame, int pass) {
    GL11.glPushMatrix();/* w  w w  .ja va  2  s. c  om*/
    GL11.glScalef(1f, 1f, 1f);
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f);
    if (getMetadata() == 0) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE);
        Assets.LAUNCHER_FRAME_BLOCK_MODEL.renderAll();
    } else {
        int rotation = getMetadata();
        switch (rotation) {
        case 1:
            GL11.glRotatef(180, 0, 1, 0);
            break;
        case 2:
            GL11.glRotatef(0, 0, 1, 0);
            break;
        case 3:
            GL11.glRotatef(90, 0, 1, 0);
            break;
        case 4:
            GL11.glRotatef(-90, 0, 1, 0);
            break;
        }
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE);
        Assets.LAUNCHER_FRAME_BLOCK_TOP_MODEL.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.controller.remote.antenna.ItemRendererAntennaFrame.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    int meta = item.getItemDamage();
    GL11.glPushMatrix();// ww w . j av a  2  s  .  co m
    GL11.glScalef(1f, 1f, 1f);
    GL11.glTranslatef(-0.0F, -0.5F, 0.0F);
    if (meta == 0 || meta == 1) {
        //TODO if meta == 1 change texture to say its connected to a base
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_TOWER_MODEL.renderAll();
    } else if (meta == 2) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_BASE_MODEL.renderAll();
    } else if (meta == 3) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_INTERSECTION_MODEL.renderAll();
    } else if (meta == 4) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_NOTCH_MODEL.renderAll();
    } else if (meta == 5) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_PIKE_MODEL.renderAll();
    } else if (meta == 6) //East West
    {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_ARM2_MODEL.renderAll();
    } else if (meta == 7) //North South
    {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_ARM_MODEL.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.controller.remote.antenna.TESRAntenna.java

@Override
public void renderTileEntityAt(TileEntity tile, double xx, double yy, double zz, float f) {
    GL11.glPushMatrix();/*from w w  w. jav  a  2 s.  c  o  m*/
    GL11.glTranslatef((float) xx + 0.5f, (float) yy, (float) zz + 0.5f);
    int meta = tile.getBlockMetadata();
    if (meta == 0 || meta == 1) {
        //TODO if meta == 1 change texture to say its connected to a base
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_TOWER_MODEL.renderAll();
    } else if (meta == 2) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_BASE_MODEL.renderAll();
    } else if (meta == 3) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_INTERSECTION_MODEL.renderAll();
    } else if (meta == 4) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_NOTCH_MODEL.renderAll();
    } else if (meta == 5) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_PIKE_MODEL.renderAll();
    } else if (meta == 6) //East West
    {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_ARM2_MODEL.renderAll();
    } else if (meta == 7) //North South
    {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_ARM_MODEL.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.controller.remote.display.TileSiloInterfaceClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    if (type == IItemRenderer.ItemRenderType.INVENTORY) {
        GL11.glTranslatef(-0.5f, -1.4f, -0.5f);
    } else if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(150f, 0, 1, 0);//from  www . j a  v a2 s . com
    } else if (type == IItemRenderer.ItemRenderType.EQUIPPED) {
        GL11.glRotatef(150f, 0, 1, 0);
        GL11.glTranslatef(-0.5f, -0.1f, -0.5f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE);
    Assets.FoF_STATION_MODEL.renderOnly("Group_006", "Group_007");
}