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:net.quetzi.bluepower.api.part.BPPartFace.java

License:Open Source License

public void rotateAndTranslateDynamic(Vector3 loc, int pass, float frame) {

    GL11.glTranslated(loc.getX(), loc.getY(), loc.getZ());

    GL11.glTranslated(0.5, 0.5, 0.5);/*from  ww  w. j a va  2  s  . c o m*/
    {

        switch (getFace()) {
        case 0:
            GL11.glRotated(180, 1, 0, 0);
            break;
        case 1:
            break;
        case 2:
            GL11.glRotated(90, 1, 0, 0);
            break;
        case 3:
            GL11.glRotated(90, -1, 0, 0);
            break;
        case 4:
            GL11.glRotated(90, 0, 0, -1);
            break;
        case 5:
            GL11.glRotated(90, 0, 0, 1);
            break;
        }
        GL11.glRotated(90 * (rotation == 0 || rotation == 2 ? (rotation + 2) % 4 : rotation), 0, 1, 0);
    }
    GL11.glTranslated(-0.5, -0.5, -0.5);
}

From source file:net.quetzi.bluepower.client.renderers.RenderItemBPPart.java

License:Open Source License

@SuppressWarnings("incomplete-switch")
@Override/*from   w  ww. j  a v a  2  s  .com*/
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    BPPart part = null;
    try {
        for (BPPart p : parts)
            if (p.getType().equals(PartRegistry.getPartIdFromItem(item))) {
                part = p;
                break;
            }
        if (part == null) {
            part = PartRegistry.createPartFromItem(item);
            if (part != null)
                parts.add(part);
        }
    } catch (Exception ex) {
    }
    if (part == null) {
        part = PartRegistry.createPart(PartRegistry.ICON_PART);
    }

    GL11.glPushMatrix();
    {
        switch (type) {
        case ENTITY:
            GL11.glScaled(0.5, 0.5, 0.5);
            GL11.glTranslated(-0.5, 0, -0.5);
            if (item.getItemFrame() != null)
                GL11.glTranslated(0, -0.25, 0);
            break;
        case EQUIPPED:
            break;
        case EQUIPPED_FIRST_PERSON:
            break;
        case INVENTORY:
            GL11.glTranslated(0, -0.1, 0);
            break;
        }
        part.renderItem(type, item, data);
    }
    GL11.glPopMatrix();
}

From source file:net.quetzi.bluepower.compat.fmp.MultipartBPPart.java

License:Open Source License

@Override
public void renderDynamic(Vector3 pos, float frame, int pass) {

    getPart().renderDynamic(new net.quetzi.bluepower.api.vec.Vector3(pos.x, pos.y, pos.z), pass, frame);

    if (emptyStaticRender == -1) {
        emptyStaticRender = GL11.glGenLists(1);
        GL11.glNewList(emptyStaticRender, GL11.GL_COMPILE);
        GL11.glEndList();//  w ww  .  ja  va  2  s  .c o  m
    }
    if (staticRender0 == -1 || getPart().shouldReRender())
        reRenderStatic(new Vector3(0, 0, 0), 0);
    if (staticRender1 == -1 || getPart().shouldReRender())
        reRenderStatic(new Vector3(0, 0, 0), 1);
    if (getPart().shouldReRender())
        getPart().resetRenderUpdate();

    if (getPart().shouldRenderStaticOnPass(pass)) {
        GL11.glPushMatrix();
        {
            GL11.glTranslated(pos.x, pos.y, pos.z);
            if (pass == 0) {
                GL11.glCallList(staticRender0);
            } else {
                GL11.glCallList(staticRender1);
            }
        }
        GL11.glPopMatrix();
    }

}

From source file:net.quetzi.bluepower.compat.fmp.MultipartBPPart.java

License:Open Source License

@Override
public boolean drawHighlight(MovingObjectPosition mop, EntityPlayer player, float frame) {

    ForgeDirection face = ForgeDirection.getOrientation(mop.sideHit);

    AxisAlignedBB c = net.quetzi.bluepower.util.RayTracer.getSelectedCuboid(mop, player, face, getSubParts(),
            true);/*from  w  w w. j a v a  2  s. c o  m*/

    if (c == null)
        return true;

    GL11.glPushMatrix();
    {
        GL11.glTranslated(x() - TileEntityRendererDispatcher.staticPlayerX,
                y() - TileEntityRendererDispatcher.staticPlayerY,
                z() - TileEntityRendererDispatcher.staticPlayerZ);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glColor4d(0, 0, 0, 0);
        RenderUtils.drawCuboidOutline(new Cuboid6(c).expand(0.001));
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    GL11.glPopMatrix();

    return true;
}

From source file:net.quetzi.bluepower.part.gate.GateBase.java

License:Open Source License

@Override
public final void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();//from  ww  w. j a v a  2 s .c  om
    {

        if (type == ItemRenderType.INVENTORY) {
            GL11.glTranslated(0, 0.5, 0);
            GL11.glRotated(-12, -1, 0, 1);
        }

        /* Top */
        renderTop();

        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/bottom.png"));
        GL11.glBegin(GL11.GL_QUADS);
        /* Bottom */
        GL11.glNormal3d(0, -1, 0);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 0, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 1);
        GL11.glEnd();
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/side.png"));
        GL11.glBegin(GL11.GL_QUADS);
        /* East */
        GL11.glNormal3d(1, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(1, 0, 1, 0, 1);
        /* West */
        GL11.glNormal3d(-1, 0, 0);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 0, 1, 0);
        /* North */
        GL11.glNormal3d(0, 0, -1);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 0, 1, 1);
        RenderHelper.addVertexWithTexture(1, 0, 0, 0, 1);
        /* South */
        GL11.glNormal3d(0, 0, 1);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 1, 0, 1);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 1, 1, 0);
        GL11.glEnd();
    }
    GL11.glPopMatrix();
}

From source file:net.roryclaasen.rorysmod.render.RenderLaser.java

License:Apache License

@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) {
    GL11.glPushMatrix();//from w  w  w. j  a  v a2  s.c o  m
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick,
            0.0F, 0.0F, 1.0F);
    bindTexture(backup);
    if (entity instanceof EntityLaser) {
        EntityLaser laser = (EntityLaser) entity;
        if (Settings.coloredLaser) {
            if (laser.getNBT() != null) {
                if (laser.getLaserData().getItemCount(NBTLaser.Items.Lens) > 0) {
                    int color = ColorUtils.getIntFromColor(Color.RED);
                    if (laser.getNBT().hasKey("color")) {
                        color = ColorUtils.getIntColorFromIntArray(laser.getNBT().getIntArray("color"));
                    }
                    GL11.glBindTexture(GL11.GL_TEXTURE_2D, getTexture(color));
                }
            }
        }
    }
    model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:net.shadowmage.ancientwarfare.structure.render.RenderGateHelper.java

License:Open Source License

@Override
public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) {
    GL11.glPushMatrix();/*from w w  w  . j a  v a2  s. c o  m*/
    EntityGate gate = (EntityGate) entity;
    int typeNum = gate.getGateType().getGlobalID();

    if (gate.hurtAnimationTicks > 0) {
        float percent = ((float) gate.hurtAnimationTicks / 20.f);
        GL11.glColor4f(1.f, 1.f - percent, 1.f - percent, 1.f);
    }
    this.bindEntityTexture(entity);
    GL11.glTranslated(d0, d1, d2);
    GL11.glRotatef(f, 0, 1, 0);
    GL11.glScalef(-1, -1, 1);
    getGateRender(typeNum).doRender(entity, d0, d1, d2, f, f1);
    GL11.glColor4f(1.f, 1.f, 1.f, 1.f);
    GL11.glPopMatrix();
}

From source file:net.slimevoid.littleblocks.client.render.blocks.LittleBlocksLittleRenderer.java

License:Open Source License

public void renderLittleBlocks(IBlockAccess iblockaccess, int x, int y, int z) {
    if (this.littleBlocksToRender.size() > 0) {
        Tessellator tessellator = Tessellator.instance;
        tessellator.draw();//  www.ja  va2  s  . c  om
        GL11.glPushMatrix();

        double xS = -((x >> 4) << 4), yS = -((y >> 4) << 4), zS = -((z >> 4) << 4);

        if (!CoreLib.OPTIFINE_INSTALLED)
            GL11.glTranslated(xS, yS, zS);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        float scale = 1 / (float) ConfigurationLib.littleBlocksSize;
        GL11.glScalef(scale, scale, scale);
        if (!CoreLib.OPTIFINE_INSTALLED)
            GL11.glTranslated(-xS, -yS, -zS);

        tessellator.startDrawingQuads();
        for (LittleBlockToRender littleBlockToRender : this.littleBlocksToRender) {
            try {
                this.renderBlocks.renderBlockByRenderType(littleBlockToRender.block, littleBlockToRender.x,
                        littleBlockToRender.y, littleBlockToRender.z);
            } catch (IllegalArgumentException e) {
                LoggerLittleBlocks.getInstance("LittleBlocksMod")
                        .write(true,
                                "Issue when rendering block [" + littleBlockToRender.block.getLocalizedName()
                                        + "] failed with error [" + e.getLocalizedMessage() + "]",
                                LogLevel.DEBUG);
            }
        }
        tessellator.draw();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        tessellator.startDrawingQuads();
    }
}

From source file:net.wurstclient.features.mods.BowAimbotMod.java

License:Open Source License

@Override
public void onRender(float partialTicks) {
    if (target == null)
        return;/*www.  java  2 s . c o m*/

    // GL settings
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glLineWidth(2);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glPushMatrix();
    GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY,
            -mc.getRenderManager().renderPosZ);

    // set position
    GL11.glTranslated(target.posX, target.posY, target.posZ);

    // set size
    double boxWidth = target.width + 0.1;
    double boxHeight = target.height + 0.1;
    GL11.glScaled(boxWidth, boxHeight, boxWidth);

    // move to center
    GL11.glTranslated(0, 0.5, 0);

    double v = 1 / velocity;
    GL11.glScaled(v, v, v);

    // draw outline
    GL11.glColor4d(1, 0, 0, 0.5F * velocity);
    RenderUtils.drawOutlinedBox(TARGET_BOX);

    // draw box
    GL11.glColor4d(1, 0, 0, 0.25F * velocity);
    RenderUtils.drawSolidBox(TARGET_BOX);

    GL11.glPopMatrix();

    // GL resets
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}

From source file:net.wurstclient.features.mods.BowAimbotMod.java

License:Open Source License

@Override
public void onRenderGUI() {
    if (target == null)
        return;//from  w  w  w.j  a va 2  s  . c o  m

    // GL settings
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glPushMatrix();

    String message;
    if (velocity < 1)
        message = "Charging: " + (int) (velocity * 100) + "%";
    else
        message = "Ready To Shoot";

    // translate to center
    ScaledResolution sr = new ScaledResolution(mc);
    int msgWidth = Fonts.segoe15.getStringWidth(message);
    GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2, sr.getScaledHeight() / 2 + 1, 0);

    // background
    GL11.glColor4f(0, 0, 0, 0.5F);
    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glVertex2d(0, 0);
        GL11.glVertex2d(msgWidth + 3, 0);
        GL11.glVertex2d(msgWidth + 3, 10);
        GL11.glVertex2d(0, 10);
    }
    GL11.glEnd();

    // text
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    Fonts.segoe15.drawString(message, 2, -1, 0xffffffff);

    GL11.glPopMatrix();

    // GL resets
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
}