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:matteroverdrive.guide.infograms.InfogramCreates.java

License:Open Source License

@Override
public void drawElement(int width, int mouseX, int mouseY) {
    bindTexture(background);//ww w.j  a  va 2 s  . c  o  m
    GL11.glColor3d(1, 1, 1);
    RenderUtils.drawPlane(marginLeft, marginTop, 0, 115, 36);
    if (from != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(marginLeft + 5, marginTop + 5, 0);
        GL11.glScaled(1.5, 1.5, 1.5);
        RenderUtils.renderStack(0, 0, from);
        GL11.glPopMatrix();
    }
    if (to != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(marginLeft + 86, marginTop + 5, 0);
        GL11.glScaled(1.5, 1.5, 1.5);
        RenderUtils.renderStack(0, 0, to);
        GL11.glPopMatrix();
    }
}

From source file:matteroverdrive.guide.infograms.InfogramDepth.java

License:Open Source License

@Override
public void drawElement(int width, int mouseX, int mouseY) {
    float minPercent = 1 - Math.min(minDepth, 64) / 64f;
    float maxPercent = 1 - Math.min(maxDepth, 64) / 64f;

    if (maxDepth >= 0) {
        getFontRenderer().drawString(Integer.toString(maxDepth) + "-", 8, 8 + (int) (46 * maxPercent),
                Reference.COLOR_HOLO_GREEN.getColor());
    }// w w  w.ja  va2s .c o  m
    if (minDepth > 0) {
        getFontRenderer().drawString(Integer.toString(minDepth) + "-", 8, 8 + (int) (46 * minPercent),
                Reference.COLOR_HOLO_GREEN.getColor());
    }

    bindTexture(terrain_background);
    GL11.glColor3d(1, 1, 1);
    RenderUtils.drawPlane(marginLeft + 20.5, marginTop + 8, 0, 72.5, 53);

    RenderUtils.beginStencil();
    RenderUtils.drawStencil(marginLeft + 24, marginTop + 8 + (int) (53 * maxPercent), 24 + 69,
            8 + (int) (53 * minPercent), 1);
    bindTexture(terrain_background_stripes);
    GL11.glColor3d(1, 1, 1);
    RenderUtils.drawPlane(marginLeft + 24, marginTop + 8, 0, 69, 53);
    RenderUtils.endStencil();

    bindTexture(ore_lense_background);
    GL11.glColor3d(1, 1, 1);
    RenderUtils.drawPlane(marginLeft + 69, marginTop + 16, 0, 84, 41);

    if (stack != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(marginLeft + 123, marginTop + 21, 0);
        GL11.glScaled(1.5, 1.5, 1.5);
        RenderUtils.renderStack(0, 0, stack);
        GL11.glPopMatrix();
    }
}

From source file:matteroverdrive.util.RenderUtils.java

License:Open Source License

public static void translateToWorldCoords(Entity entity, float frame) {
    double interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
    double interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
    double interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;

    GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ);
}

From source file:mca.client.render.RenderHuman.java

License:Open Source License

@Override
protected void preRenderCallback(EntityLivingBase entityLivingBase, float partialTickTime) {
    final EntityHuman entity = (EntityHuman) entityLivingBase;
    final AISleep sleepAI = entity.getAI(AISleep.class);
    float scale = entity.getIsMale() ? Constants.SCALE_M_ADULT : Constants.SCALE_F_ADULT;

    if (entity.getIsChild()) {
        final boolean doGradualGrowth = MCA.getConfig().isAgingEnabled;
        final float growthFactor = (entity.getIsMale() ? 0.39F : 0.37F) / MCA.getConfig().childGrowUpTime
                * entity.getAge();/*  ww  w  .ja  va2  s .  c om*/

        scale = 0.55F + growthFactor;

        if (entityLivingBase.ridingEntity != null) {
            GL11.glTranslated(0.0D, (1.0D + growthFactor) + growthFactor, 0.2D);
        }
    }

    GL11.glScalef(scale, scale + entity.getHeight(), scale);
    GL11.glScalef(scale + entity.getGirth(), scale, scale + entity.getGirth());

    if (sleepAI.getIsInBed()) {
        renderHumanSleeping(entity, partialTickTime);
    }

    else if (entityLivingBase.ridingEntity != null) {
        GL11.glTranslated(0.0D, 0.55D, 0.1D);
    }
}

From source file:mca.client.render.RenderHuman.java

License:Open Source License

protected void renderHumanSleeping(EntityHuman entity, double partialTickTime) {
    final AISleep sleepAI = entity.getAI(AISleep.class);
    final int meta = sleepAI.getBedMeta();

    if (meta == 8) {
        entity.rotationYawHead = 180.0F;
        GL11.glTranslated(-0.5D, 0.0D, -1.0D);
        GL11.glRotated(90, -1, 0, 0);//from   w ww  . java 2  s  .  c o m
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }

    else if (meta == 11) {
        entity.rotationYawHead = 90.0F;
        GL11.glTranslated(0.5D, 0.0D, -1.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }

    else if (meta == 10) {
        entity.rotationYawHead = 0.0F;
        GL11.glTranslated(0.5D, 0.0D, -2.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }

    else if (meta == 9) {
        entity.rotationYawHead = -90.0F;
        GL11.glTranslated(-0.5D, 0.0D, -2.0D);
        GL11.glRotated(90, -1, 0, 0);
        GL11.glTranslated(0.0D, 0.0D, -0.75D);
    }
}

From source file:mca.client.render.RenderMemorial.java

License:Open Source License

public void renderMemorialAt(TileMemorial memorialEntity, double posX, double posY, double posZ,
        float partialTickTime) {
    GL11.glPushMatrix();//from  www .  j ava  2  s .c om

    GL11.glTranslated(posX + 0.50F, posY + 1.5F, posZ + 0.53F);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glScalef(0.7F, 1.0F, 0.7F);

    try {
        switch (memorialEntity.getType()) {
        case BROKEN_RING:
            bindResource(RING_TEXTURE);
            memorialModel.renderRing();
            break;
        case TRAIN:
            bindResource(TRAIN_TEXTURE);
            memorialModel.renderTrain();
            break;
        case DOLL:
            bindResource(DOLL_TEXTURE);
            memorialModel.renderDoll();
            break;
        }
    }

    catch (Exception e) {
        //Pass
    }

    GL11.glPopMatrix();
}

From source file:mca.client.render.RenderTombstone.java

License:Open Source License

public void renderTombstoneAt(TileTombstone tombstoneEntity, double posX, double posY, double posZ,
        float partialTickTime) {
    final StringBuilder stringBuilder = new StringBuilder();
    final FontRenderer fontRendererObj = func_147498_b();

    final int meta = tombstoneEntity.getBlockMetadata();
    final float rotation = setRotationByMeta(meta);

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

    GL11.glTranslated(posX + 0.50F, posY + 1.59F, posZ + 0.53F);
    GL11.glRotatef(-rotation, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0, 0.5F, 0);
    GL11.glScalef(1.4F, 1.4F, 1.4F);

    bindResource(TEXTURE);

    GL11.glPushMatrix();
    {
        GL11.glScalef(1F, -1F, -1F);
        tombstoneModel.renderTombstone();
    }
    GL11.glPopMatrix();

    //Text size is 0.017F.
    GL11.glTranslatef(0.0F, -1.15F, 0.07F);
    GL11.glScalef(0.017F / 2, -0.017F / 2, 0.017F / 2);
    GL11.glNormal3f(0.0F, 0.0F, -1F * 0.017F);
    GL11.glDepthMask(false);

    for (int line = 0; line < tombstoneEntity.signText.length; line++) {
        String lineText = tombstoneEntity.signText[line];

        if (line == tombstoneEntity.lineBeingEdited) {
            lineText = stringBuilder.append("> ").append(lineText).append(" <").toString();
        }

        fontRendererObj.drawString(lineText, -fontRendererObj.getStringWidth(lineText) / 2,
                line * 10 - tombstoneEntity.signText.length * 5, 0x000000);
    }

    GL11.glDepthMask(true);
    GL11.glPopMatrix();
}

From source file:minesweeperMod.client.MinesweeperDrawBlockHighlightHandler.java

License:LGPL

public static void highlightTile(EntityPlayer player, double x, double y, double z, float partialTicks,
        int tile) {
    x += 0.5D;/*from w  w w  .  ja  v a2  s .  co  m*/
    y += 0.5D;
    z += 0.5D;
    double iPX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
    double iPY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
    double iPZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;

    float xScale = 1.0F;
    float yScale = 1;
    float zScale = 1.0F;
    float xShift = 0.0F;
    float yShift = 0.01F;
    float zShift = 0.0F;

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 4; i < 5; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        drawQuad(-0.5F, -0.5F, 1F, 1F, 0F, tile);
        GL11.glPopMatrix();
    }

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(true);
}

From source file:mods.railcraft.client.render.RenderTESRSignals.java

License:Open Source License

protected static void doRenderAspect(RenderFakeBlock.RenderInfo info, TileEntity tile, double x, double y,
        double z) {
    Tessellator tessellator = Tessellator.instance;
    final float depth = 2 * RenderTools.PIXEL;

    GL11.glPushMatrix();// w  w  w.  j a  v  a  2  s . c  o m
    GL11.glTranslated(x, y, z);
    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    tessellator.startDrawingQuads();

    if (info.brightness < 0) {
        float light;
        float lightBottom = 0.5F;
        if (info.light < 0) {
            light = 1;
        } else {
            light = info.light;
        }
        int br;
        if (info.brightness < 0) {
            br = info.template.getMixedBrightnessForBlock(tile.getWorldObj(), tile.xCoord, tile.yCoord,
                    tile.zCoord);
        } else {
            br = info.brightness;
        }
        tessellator.setBrightness(br);
        tessellator.setColorOpaque_F(lightBottom * light, lightBottom * light, lightBottom * light);
    } else {
        tessellator.setBrightness(info.brightness);
    }

    if (info.renderSide[2]) {
        tessellator.addVertexWithUV(0, 0, depth, info.texture[2].getInterpolatedU(16),
                info.texture[2].getInterpolatedV(16));
        tessellator.addVertexWithUV(0, 1, depth, info.texture[2].getInterpolatedU(16),
                info.texture[2].getInterpolatedV(0));
        tessellator.addVertexWithUV(1, 1, depth, info.texture[2].getInterpolatedU(0),
                info.texture[2].getInterpolatedV(0));
        tessellator.addVertexWithUV(1, 0, depth, info.texture[2].getInterpolatedU(0),
                info.texture[2].getInterpolatedV(16));
    }
    if (info.renderSide[3]) {
        tessellator.addVertexWithUV(0, 0, 1 - depth, info.texture[3].getInterpolatedU(0),
                info.texture[3].getInterpolatedV(16));
        tessellator.addVertexWithUV(1, 0, 1 - depth, info.texture[3].getInterpolatedU(16),
                info.texture[3].getInterpolatedV(16));
        tessellator.addVertexWithUV(1, 1, 1 - depth, info.texture[3].getInterpolatedU(16),
                info.texture[3].getInterpolatedV(0));
        tessellator.addVertexWithUV(0, 1, 1 - depth, info.texture[3].getInterpolatedU(0),
                info.texture[3].getInterpolatedV(0));
    }
    if (info.renderSide[4]) {
        tessellator.addVertexWithUV(depth, 0, 0, info.texture[4].getInterpolatedU(0),
                info.texture[4].getInterpolatedV(16));
        tessellator.addVertexWithUV(depth, 0, 1, info.texture[4].getInterpolatedU(16),
                info.texture[4].getInterpolatedV(16));
        tessellator.addVertexWithUV(depth, 1, 1, info.texture[4].getInterpolatedU(16),
                info.texture[4].getInterpolatedV(0));
        tessellator.addVertexWithUV(depth, 1, 0, info.texture[4].getInterpolatedU(0),
                info.texture[4].getInterpolatedV(0));
    }
    if (info.renderSide[5]) {
        tessellator.addVertexWithUV(1 - depth, 0, 0, info.texture[5].getInterpolatedU(16),
                info.texture[5].getInterpolatedV(16));
        tessellator.addVertexWithUV(1 - depth, 1, 0, info.texture[5].getInterpolatedU(16),
                info.texture[5].getInterpolatedV(0));
        tessellator.addVertexWithUV(1 - depth, 1, 1, info.texture[5].getInterpolatedU(0),
                info.texture[5].getInterpolatedV(0));
        tessellator.addVertexWithUV(1 - depth, 0, 1, info.texture[5].getInterpolatedU(0),
                info.texture[5].getInterpolatedV(16));
    }

    tessellator.draw();

    GL11.glPopMatrix();
}

From source file:nanoenergy.client.model.ModelCalcinator.java

License:LGPL

public void render(TileNanoTable tileNanoTable, double x, double y, double z) {

    GL11.glPushMatrix();//ww  w.  j a v  a  2 s  . c  o  m
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glTranslated(x, y, z);
    ForgeHooksClient.bindTexture("/nanoenergy/calcinator.png", 0);
    this.render(scale);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}