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.irr310.i3d.scene.element.I3dElement.java

License:Open Source License

/**
 * Internal public method Mthode principal du rendu de selection d'un
 * lment. Cette mthode appelle le code de rendu de selection spcifique
 * de l'lment via la mthode doSelect si ncessaire. Les animations
 * n'entrent pas en jeu dans le rendu de selection.
 * /*from w  w  w  . j  ava2  s .  c om*/
 * @param gl
 *            context gl du rendu de selection
 * @param camera
 *            point de vue
 */
final public void select(I3dCamera camera, long parentId) {

    if (!inited) {
        init();
    }

    if (!isTangible() || !showShape) {
        return;
    }

    GL11.glPushMatrix();

    // TODO: verify this cast. Maybe change id from long to int
    if (selectable) {
        GL11.glLoadName((int) id);
    }

    if (rotation.x != 0) {
        GL11.glRotatef(rotation.x, 1, 0, 0);
    }
    if (rotation.y != 0) {
        GL11.glRotatef(rotation.y, 0, 1, 0);
    }
    if (rotation.z != 0) {
        GL11.glRotatef(rotation.z, 0, 0, 1);
    }

    if (position.x != 0 || position.y != 0 || position.z != 0) {
        GL11.glTranslatef(position.x, position.y, position.z);
    }

    if (scale.x != 1 || scale.y != 1 || scale.z != 1) {
        GL11.glScalef(scale.x, scale.y, scale.z);
    }

    if (selectable) {
        doSelect(camera, id);
    } else {
        doSelect(camera, parentId);
    }

    if (selectable) {
        GL11.glLoadName((int) parentId);
    }

    GL11.glPopMatrix();

}

From source file:com.itszuvalex.femtocraft.power.render.RenderChargingBase.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockAtmosphericChargingBase base = (BlockAtmosphericChargingBase) block;
    if (base == null) {
        return;//  w  ww .ja  v  a  2 s . com
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderBase(base, 0, 0, 0);
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

}

From source file:com.itszuvalex.femtocraft.power.render.RenderChargingCapacitor.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockAtmosphericChargingCapacitor capacitor = (BlockAtmosphericChargingCapacitor) block;
    if (capacitor == null) {
        return;//  w ww. jav a 2  s. c om
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderCapacitor(capacitor, 0, 0, 0);
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:com.itszuvalex.femtocraft.power.render.RenderChargingCoil.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockAtmosphericChargingCoil coil = (BlockAtmosphericChargingCoil) block;
    if (coil == null) {
        return;/*from w  ww  . ja v a 2s .c om*/
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderCoil(coil, 0, 0, 0);
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:com.itszuvalex.femtocraft.power.render.RenderCryoEndothermalChargingCoil.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockCryoEndothermalChargingCoil coil = (BlockCryoEndothermalChargingCoil) block;
    if (coil == null) {
        return;//www  .j a  va2 s. c  om
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderCoil(coil, 0, 0, 0);
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:com.itszuvalex.femtocraft.power.render.RenderFemtoCable.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockFemtoCable cable = (BlockFemtoCable) block;
    if (cable == null) {
        return;/* www.jav a 2s  .c  o  m*/
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderCable(cable, 0, 0, 0, new boolean[] { false, false, true, true, false, false });
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:com.itszuvalex.femtocraft.power.render.RenderMicroCable.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockMicroCable cable = (BlockMicroCable) block;
    if (cable == null) {
        return;/*from   www  .  j  a  v a2s  .c o  m*/
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderCable(cable, 0, 0, 0, new boolean[] { false, false, true, true, false, false });
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:com.itszuvalex.femtocraft.power.render.RenderNanoCable.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    BlockNanoCable cable = (BlockNanoCable) block;
    if (cable == null) {
        return;//ww  w.  j av a2s . c om
    }

    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setColorOpaque_F(1, 1, 1);
    renderCable(cable, 0, 0, 0, new boolean[] { false, false, true, true, false, false });
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:com.itszuvalex.femtocraft.power.render.RenderNullEqualizer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
    GL11.glPushMatrix();//  w  ww  .j a  v  a2  s. c o m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    Minecraft.getMinecraft().renderEngine.bindTexture(
            new ResourceLocation(Femtocraft.ID().toLowerCase(), "textures/blocks/blockNullEqualizer.png"));
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    model.render();
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:com.itszuvalex.femtocraft.power.render.RenderOrbitalEqualizer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
    GL11.glPushMatrix();//  ww w.j a v a2s  .  co m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    Minecraft.getMinecraft().renderEngine.bindTexture(
            new ResourceLocation(Femtocraft.ID().toLowerCase(), "textures/blocks/blockOrbitalEqualizer.png"));
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    model.render();
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}