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.ethylamine.fsynthesis.client.renderer.item.TungstenChestItemRenderer.java

License:Open Source License

private void renderPlotoniumChest(ImmutableTriple<Float, Float, Float> offset) {
    GL11.glPushMatrix();//from  ww  w  .  java  2 s  .c o m

    GL11.glScalef(SCALE.left, SCALE.middle, SCALE.right);
    GL11.glTranslatef(offset.left, offset.middle, offset.right);
    GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(90.0f, 0.0f, -1.0f, 0.0f);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TungstenChestTESR.TEXTURE);

    vanillaChest.renderAll();

    GL11.glPopMatrix();
}

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

License:Open Source License

@SuppressWarnings("NumericCastThatLosesPrecision")
@Override//from  w  w  w.ja  v a  2 s.  c  o  m
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    if (tileEntity instanceof TileEntityDisintegrater) {
        final TileEntityDisintegrater te = (TileEntityDisintegrater) tileEntity;

        // Open Render buffer
        GL11.glPushMatrix();

        // Position Renderer
        GL11.glTranslatef((float) x, (float) y, (float) z);

        renderDisintegrater(te);

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

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  ww  .  ja  v a2  s  . c om*/
    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 a  v  a  2 s .c o m

        // 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();//w  ww. j  ava 2s  .com

    // 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.flaiker.geometri.tileentities.TileEntityMathRenderer.java

License:MIT License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
    TileEntityMath myte = ((TileEntityMath) te);

    model.prepareForRender(myte.getCoordinatePairs());

    TextureManager tm = Minecraft.getMinecraft().getTextureManager();
    tm.bindTexture(new ResourceLocation(Geometri.MODID, "textures/blocks/testBlock.png"));

    GL11.glPushMatrix();/*from w ww  . j  a  v  a 2 s .  c  o m*/

    GL11.glTranslatef((float) x, (float) y, (float) z);

    model.render();

    GL11.glPopMatrix();
}

From source file:com.fr3gu.letsmod.client.RenderSpaceship.java

License:LGPL

public void renderSpaceship(EntitySpaceship spaceship, double x, double y, double z, float yaw,
        float partialTickTime) {
    GL11.glPushMatrix();/*from ww  w  . j a va  2  s  . co m*/
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F);
    GL11.glScaled(-1.0F, -1.0F, 1.0F);

    func_110777_b(spaceship);

    model.render(spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    GL11.glPopMatrix();
}

From source file:com.freyja.FES.client.models.ModelInjector.java

License:LGPL

public void render(RoutingEntity te, double x, double y, double z) {
    GL11.glPushMatrix();/*from ww w .j a  v a  2 s  .c  om*/

    GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f);

    ForgeDirection orientation = te.getOrientation();

    if (orientation == ForgeDirection.DOWN) {
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glTranslatef(0, -1f, 0f);
    }

    if (orientation == ForgeDirection.SOUTH) {
        GL11.glRotatef(90, 1, 0, 0);
        GL11.glTranslatef(0, -.5f, -.5f);
    }

    if (orientation == ForgeDirection.NORTH) {
        GL11.glRotatef(90, -1, 0, 0);
        GL11.glTranslatef(0, -.5f, .5f);
    }

    if (orientation == ForgeDirection.WEST) {
        GL11.glRotatef(90, 0, 0, 1);
        GL11.glTranslatef(.5f, -.5f, 0);
    }

    if (orientation == ForgeDirection.EAST) {
        GL11.glRotatef(90, 0, 0, -1);
        GL11.glTranslatef(-.5f, -.5f, 0);
    }

    GL11.glScalef(0.5f, 0.5f, 0.5f);

    FMLClientHandler.instance().

            getClient()

                    .renderEngine.bindTexture("/mods/FES/textures/injector.png");
    this.

            render();

    GL11.glPopMatrix();
}

From source file:com.freyja.FES.client.models.ModelReceptacle.java

License:LGPL

public void render(RoutingEntity te, double x, double y, double z) {
    GL11.glPushMatrix();//from   w  w  w  . ja  v  a 2s  . c o m

    GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f);

    ForgeDirection orientation = te.getOrientation();

    if (orientation == ForgeDirection.DOWN) {
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glTranslatef(0, -1f, 0f);
    }

    if (orientation == ForgeDirection.SOUTH) {
        GL11.glRotatef(90, 1, 0, 0);
        GL11.glTranslatef(0, -.5f, -.5f);
    }

    if (orientation == ForgeDirection.NORTH) {
        GL11.glRotatef(90, -1, 0, 0);
        GL11.glTranslatef(0, -.5f, .5f);
    }

    if (orientation == ForgeDirection.WEST) {
        GL11.glRotatef(90, 0, 0, 1);
        GL11.glTranslatef(.5f, -.5f, 0);
    }

    if (orientation == ForgeDirection.EAST) {
        GL11.glRotatef(90, 0, 0, -1);
        GL11.glTranslatef(-.5f, -.5f, 0);
    }

    GL11.glScalef(0.5f, 0.5f, 0.5f);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/FES/textures/receptacle.png");

    this.render();

    GL11.glPopMatrix();
}

From source file:com.freyja.FES.client.renderers.ItemRenderInjector.java

License:LGPL

private void renderInjector(float x, float y, float z, float scale) {
    GL11.glPushMatrix();// ww  w  .ja  v  a2 s  .  co m

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glTranslatef(x, y, z);
    GL11.glScalef(scale, scale, scale);
    GL11.glRotatef(180f, 0f, 1f, 0f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/FES/textures/injector.png");
    modelInjector.render();

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