Example usage for org.lwjgl.opengl GL11 glTranslated

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

Introduction

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

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

Usage

From source file:makeo.gadomancy.client.renderers.tile.RenderTileRemoteJar.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//from w  w  w . j av  a  2 s. co  m
    GL11.glTranslated(x, y, z);

    GL11.glPushMatrix();

    GL11.glTranslatef(0.45f / 2, 0.003f, 0.45f / 2);
    GL11.glScalef(0.55f, 1, 0.55f);

    TileMirrorRenderer renderer = new TileMirrorRenderer();

    renderer.func_147497_a(this.field_147501_a);

    if (field_147501_a.field_147553_e != null) {
        renderer.renderTileEntityAt(createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), 0,
                0, 0, partialTicks);
    }

    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glTranslatef(0.5f, 0.002f, 0.5f);
    GL11.glRotatef(180, 0, 0, 1);

    bindTexture(OVERLAY_TEXTURE);

    GL11.glScalef(1.002f, 1f, 1.002f);

    GL11.glTranslatef(0, -1.5f, 0);
    //GL11.glRotatef(180, 1f, 0, 0);

    MODEL_JAR_POT.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f);

    GL11.glPopMatrix();
    GL11.glPopAttrib();

    super.renderTileEntityAt(tile, x, y, z, partialTicks);
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileStickyJar.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    if (tile != null && tile instanceof TileStickyJar && ((TileStickyJar) tile).isValid()) {
        TileStickyJar stickyJar = (TileStickyJar) tile;

        TileJarFillable parent = stickyJar.getParent();
        World world = tile.getWorldObj();
        Block block = stickyJar.getParentBlock();

        GL11.glPushMatrix();// w  ww.jav a2 s .  com

        GL11.glTranslated(x, y, z);
        rotateJar(stickyJar.placedOn, ForgeDirection.getOrientation(stickyJar.facing));

        //TESR
        TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(parent);
        if (renderer != null) {
            stickyJar.syncToParent();

            renderer.renderTileEntityAt(parent, 0, 0, 0, partialTicks);

            stickyJar.syncFromParent();
        }

        //ISimpleBlockHandler
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        bindTexture(TextureMap.locationBlocksTexture);

        RENDER_BLOCKS.blockAccess = world;

        Tessellator tess = Tessellator.instance;
        tess.startDrawingQuads();

        tess.setNormal(0, -stickyJar.placedOn.offsetY,
                -Math.abs(stickyJar.placedOn.offsetZ + stickyJar.placedOn.offsetX));

        tess.setTranslation(-tile.xCoord, -tile.yCoord, -tile.zCoord);

        RENDER_BLOCKS.renderBlockByRenderType(block, tile.xCoord, tile.yCoord, tile.zCoord);

        tess.setTranslation(0, 0, 0);
        tess.draw();

        GL11.glPopAttrib();
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }
}

From source file:matteroverdrive.client.render.entity.EntityRendererPhaserFire.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *//* w w w.ja  v  a  2 s  .  co  m*/
public void doRender(PlasmaBolt plasmaBolt, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    this.bindEntityTexture(plasmaBolt);
    RenderUtils.disableLightmap();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    RenderUtils.applyColorWithMultipy(plasmaBolt.getColor(),
            MOEasing.Quad.easeOut(plasmaBolt.getLife(), 0, 1, 0.7f));
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(plasmaBolt.prevRotationYaw
            + (plasmaBolt.rotationYaw - plasmaBolt.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(plasmaBolt.prevRotationPitch
            + (plasmaBolt.rotationPitch - plasmaBolt.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) (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;
    float renderSize = plasmaBolt.getRenderSize();
    double length = 6
            * Vec3.createVectorHelper(plasmaBolt.motionX, plasmaBolt.motionY, plasmaBolt.motionZ).lengthVector()
            + 10;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_CULL_FACE);

    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(1, -renderSize, -renderSize, (double) f6, (double) f8);
    tessellator.addVertexWithUV(1, -renderSize, renderSize, (double) f7, (double) f8);
    tessellator.addVertexWithUV(1, renderSize, renderSize, (double) f7, (double) f9);
    tessellator.addVertexWithUV(1, renderSize, -renderSize, (double) f6, (double) f9);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(length - 1, -renderSize, renderSize, (double) f7, (double) f8);
    tessellator.addVertexWithUV(length - 1, renderSize, renderSize, (double) f7, (double) f9);
    tessellator.addVertexWithUV(length - 1, renderSize, -renderSize, (double) f6, (double) f9);
    tessellator.addVertexWithUV(length - 1, -renderSize, -renderSize, (double) f6, (double) f8);
    tessellator.draw();

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

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    RenderUtils.enableLightmap();
}

From source file:matteroverdrive.client.render.entity.EntityRendererRangedRougeAndroid.java

License:Open Source License

@Override
protected void func_82422_c() {
    GL11.glTranslated(0, 0.2, -0.3);
    GL11.glRotatef(-97, 0, 0, 1.0F);
    GL11.glRotatef(-60, 0.0F, 1.0F, 0.0F);
    GL11.glScaled(0.6, 0.6, 0.6);
}

From source file:matteroverdrive.client.render.parts.BionicPartRenderer.java

License:Open Source License

protected void translateFromPlayer(EntityPlayer entityPlayer, float partialRenderTick) {
    if (entityPlayer != Minecraft.getMinecraft().thePlayer) {
        Vec3 clientPos = Minecraft.getMinecraft().thePlayer.getPosition(partialRenderTick);
        Vec3 pos = entityPlayer.getPosition(partialRenderTick);
        GL11.glTranslated(pos.xCoord - clientPos.xCoord,
                pos.yCoord - clientPos.yCoord + entityPlayer.getEyeHeight() - 0.2,
                pos.zCoord - clientPos.zCoord);
    }//from  w w w. j a va 2 s.c o  m
}

From source file:matteroverdrive.guide.GuideElementPage.java

License:Open Source License

@Override
public void drawElement(int width, int mouseX, int mouseY) {
    GL11.glPushMatrix();/*from  w w w.  j av  a2 s  . com*/
    GL11.glTranslated(marginLeft, marginTop, 0);
    int x = 0;
    int y = 0;
    int floatRightX = width;
    int maxHeight = 0;

    for (IGuideElement element : elements) {
        GL11.glPushMatrix();
        if (element.getFloating() == 2) {
            GL11.glTranslated(floatRightX - element.getWidth() - marginLeft, 0, 0);
        }
        GL11.glTranslated(x, y, 0);
        element.drawElement(width - marginLeft - marginRight, mouseX - x - marginLeft, mouseY - y - marginTop);
        if (element.getFloating() == 1) {
            if (x + element.getWidth() > width) {
                y += maxHeight;
                x = 0;
                floatRightX = width;
                maxHeight = 0;
            } else {
                maxHeight = Math.max(element.getHeight(), maxHeight);
                x += element.getWidth();
            }
        } else if (element.getFloating() == 2) {
            if (floatRightX - element.getWidth() < 0) {
                maxHeight = Math.max(maxHeight, element.getHeight());
                floatRightX = width;
                y += maxHeight;
                maxHeight = 0;
            } else {
                floatRightX -= element.getWidth();
            }
        } else {
            maxHeight = Math.max(maxHeight, element.getHeight());
            y += maxHeight;
            maxHeight = 0;
            x = 0;
            floatRightX = width;
        }
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}

From source file:matteroverdrive.guide.GuideElementPreview.java

License:Open Source License

@Override
public void drawElement(int width, int mouseX, int mouseY) {
    if (itemStack != null) {
        GL11.glPushMatrix();/*from   w w  w  .j a  v a  2s  . co m*/

        if (textAlign == 1)
            GL11.glTranslated(width / 2 - 8 * size, 0, 0);
        else if (textAlign == 2)
            GL11.glTranslated(width - 16 * size, 0, 0);

        GL11.glTranslated(marginLeft, marginTop, 0);
        GL11.glScaled(size, size, size);
        RenderUtils.renderStack(0, 0, itemStack);
        GL11.glPopMatrix();
    }
}

From source file:matteroverdrive.guide.GuideElementRecipe.java

License:Open Source License

@Override
public void drawElement(int width, int mouseX, int mouseY) {
    GL11.glPushMatrix();//  ww  w .  j  a  va 2s .c om
    if (textAlign == 1) {
        GL11.glTranslated(marginLeft + this.width / 2 - 110 / 2, marginTop, 0);
    } else {
        GL11.glTranslated(marginLeft, marginTop, 0);
    }
    bindTexture(background);
    RenderUtils.applyColor(Reference.COLOR_MATTER);
    RenderUtils.drawPlane(8, 8, 0, 96, 96);
    if (recipeItems != null && recipe != null) {

        for (int x = 0; x < 3; x++) {
            for (int y = 0; y < 3; y++) {
                int index = x + y * 3;
                if (index < recipeItems.length) {
                    if (recipeItems[index] instanceof ItemStack) {
                        ItemStack stack = (ItemStack) recipeItems[index];
                        renderStack(stack, x, y);
                    } else if (recipeItems[index] instanceof List) {
                        List stacks = (List) recipeItems[index];
                        if (stacks.size() > 0) {
                            int stackIndex = (int) ((Minecraft.getMinecraft().theWorld.getWorldTime() / 100)
                                    % (stacks.size()));
                            if (stackIndex < stacks.size() && stacks.get(stackIndex) instanceof ItemStack) {
                                renderStack((ItemStack) stacks.get(stackIndex), x, y);
                            }
                        }
                    }
                }
            }
        }
    }
    GL11.glPopMatrix();
}

From source file:matteroverdrive.guide.GuideElementRecipe.java

License:Open Source License

private void renderStack(ItemStack stack, int x, int y) {
    if (stack != null) {

        GL11.glPushMatrix();/*from  w  w  w  .  jav a 2s  .  c om*/
        GL11.glTranslated(10 + x * 33, 9 + y * 33, 0);
        GL11.glScaled(1.5, 1.5, 1.5);
        RenderUtils.renderStack(0, 0, stack);
        GL11.glPopMatrix();
    }
}

From source file:matteroverdrive.guide.GuideElementTitle.java

License:Open Source License

@Override
public void drawElement(int width, int mouseX, int mouseY) {
    GL11.glPushMatrix();// www.j  a  v a  2  s .com
    int titleWidth = (int) (getFontRenderer().getStringWidth(title) * size);
    int x = 0;
    if (textAlign == 1) {
        x = (width - marginLeft - marginRight) / 2 - titleWidth / 2;
    } else if (textAlign == 2) {
        x = (width - marginLeft - marginRight) - titleWidth;
    }
    GL11.glTranslated(x + marginLeft, marginTop, 0);
    GL11.glScaled(size, size, size);
    getFontRenderer().drawString(title, 0, 0, color.getColor());
    GL11.glPopMatrix();
}