Example usage for org.lwjgl.opengl GL11 glRotated

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

Introduction

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

Prototype

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

Source Link

Document

Double version of #glRotatef Rotatef .

Usage

From source file:cn.liutils.api.draw.prop.Transform.java

License:Open Source License

public void perform() {
    GL11.glTranslated(tx, ty, tz);//from   w  w w.  j  ava2 s .com
    GL11.glTranslated(pivotX, pivotY, pivotZ);
    GL11.glRotated(yaw, 0, 1, 0);
    GL11.glRotated(pitch, 1, 0, 0);
    GL11.glRotated(roll, 0, 0, 1);
    GL11.glTranslated(-pivotX, -pivotY, -pivotZ);
}

From source file:cn.liutils.template.block.RenderBlockMulti.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if (!(te.getBlockType() instanceof BlockMulti))
        return;/*w  w w. ja  va 2  s  .  com*/

    BlockMulti bm = (BlockMulti) te.getBlockType();
    InfoBlockMulti inf = ((IMultiTile) te).getBlockInfo();

    if (inf == null || !inf.isLoaded() || inf.subID != 0)
        return;
    GL11.glPushMatrix();
    double[] off = bm.getPivotOffset(inf);
    double[] off2 = bm.rotCenters[inf.dir.ordinal()];
    GL11.glTranslated(x + off[0] + off2[0], y + 0 + off2[1], z + off[1] + off2[2]);
    //GL11.glTranslated(x, y, z);
    GL11.glRotated(bm.getRotation(inf), 0, 1, 0);
    drawAtOrigin(te);
    GL11.glPopMatrix();
}

From source file:cn.weaponry.api.client.render.RendererWeapon.java

License:Open Source License

private void handleEntityItemRender(ItemStack stack) {
    GL11.glPushMatrix();/*  w  w w.  ja  v  a 2 s .com*/
    {
        GL11.glRotated(30, 0, 0, 1);
        stdTransform.doTransform();
        RenderUtils.loadTexture(texture);
        model.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.client.render.RenderEngine.java

License:Open Source License

@SuppressWarnings("cast")
@Override/*from w ww .j  a  v a2s  . c om*/
public void renderTileEntityAt(TileEntity engine, double x, double y, double z, float f) {

    if (engine instanceof TileEngine) {

        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_LIGHTING);
        TileEngine tile = (TileEngine) engine.getWorldObj().getTileEntity(engine.xCoord, engine.yCoord,
                engine.zCoord);

        ForgeDirection direction = tile.getOrientation();

        GL11.glTranslated(x, y, z);
        GL11.glScaled(.0315, .0315, .0315);

        if (direction == ForgeDirection.UP) {
            GL11.glTranslated(16, 28, 16);
            GL11.glRotatef(180, 1, 0, 0);
        }
        if (direction == ForgeDirection.DOWN) {
            GL11.glTranslated(16, 4, 16);
            GL11.glRotatef(0, 0, 0, 0);
        }
        if (direction == ForgeDirection.EAST) {
            GL11.glTranslated(28, 16, 16);
            GL11.glRotatef(90, 0, 0, 1);
        }
        if (direction == ForgeDirection.WEST) {
            GL11.glTranslated(4, 16, 16);
            GL11.glRotatef(90, 0, 0, -1);
        }
        if (direction == ForgeDirection.NORTH) {
            GL11.glTranslated(16, 16, 4);
            GL11.glRotatef(90, 1, 0, 0);
        }
        if (direction == ForgeDirection.SOUTH) {
            GL11.glTranslated(16, 16, 28);
            GL11.glRotatef(90, -1, 0, 0);
        }
        if (tile.isActive) {
            bindTexture(textureLocationOn);
        } else {
            bindTexture(textureLocationOff);
        }
        engineModel.renderAllExcept("gear", "glider");

        if (tile.isActive) {
            f += tile.pumpTick;
            if (tile.pumpSpeed > 0) {
                f /= tile.pumpSpeed;
            }
        } else {
            f = 0;
        }
        f = (float) ((float) 6 * (.5 - .5 * Math.cos(3.1415926535897931D * (double) f)));
        GL11.glTranslatef(0, f, 0);

        engineModel.renderPart("glider");

        GL11.glTranslatef(0, -f, 0);

        if (tile.isActive) {
            if (tile.getWorldObj().isRemote) {
                rotateAmount++;

                GL11.glRotated(tile.gearTick * 19, 0, 1.5707963267948966D * (double) f, 0);
            }
        }
        engineModel.renderPart("gear");

        GL11.glEnable(GL11.GL_LIGHTING);

        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

public static void renderButton(double x, double y, double z, String res, String resSide) {

    GL11.glPushMatrix();//from   w w  w  .  ja v  a  2 s  .co  m
    {
        GL11.glTranslated(x, y, z);

        GL11.glPushMatrix();
        {
            GL11.glTranslated(6 / 16D, 2 / 16D, 8 / 16D);
            Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(resSide));
            for (int i = 0; i < 4; i++) {
                GL11.glTranslated(2 / 16D, 0, 2 / 16D);
                GL11.glRotated(90, 0, 1, 0);
                GL11.glTranslated(-2 / 16D, 0, -2 / 16D);
                GL11.glBegin(GL11.GL_QUADS);
                {
                    GL11.glNormal3d(1, 0, 0);
                    addVertexWithTexture(0, 0, 0, 0, 0);
                    addVertexWithTexture(0, 1 / 16D, 0, 0, 1);
                    addVertexWithTexture(4 / 16D, 1 / 16D, 0, 1, 1);
                    addVertexWithTexture(4 / 16D, 0, 0, 1, 0);
                }
                GL11.glEnd();
            }
        }
        GL11.glPopMatrix();

        GL11.glTranslated(0, 1 / 16D, 0 / 16D);

        Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(res));
        Tessellator t = Tessellator.instance;

        y = 2 / 16D;

        t.startDrawingQuads();
        t.setNormal(0, 1, 0);
        {
            t.addVertexWithUV(0, y, 0, 1, 1);
            t.addVertexWithUV(0, y, 1, 1, 0);
            t.addVertexWithUV(1, y, 1, 0, 0);
            t.addVertexWithUV(1, y, 0, 0, 1);
        }
        t.draw();
    }
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

/**
 * @author amadornes/*  www .j a va2  s . co  m*/
 * @param x
 * @param y
 * @param z
 * @param angle
 */
public static void renderPointer(double x, double y, double z, double angle) {

    GL11.glPushMatrix();
    {
        GL11.glTranslated(x, y, z);

        GL11.glTranslated(0.5, 0.5, 0.5);
        GL11.glRotated(180 + 360 * -angle, 0, 1, 0);
        GL11.glTranslated(-0.5, -0.5, -0.5);

        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation("minecraft:textures/blocks/stone.png"));

        GL11.glBegin(GL11.GL_QUADS);
        {
            GL11.glNormal3d(0, -1, 0);
            // Bottom
            addVertexWithTexture(0.5, 0, 2D / 16D, 0.5, 1D / 16D);
            addVertexWithTexture(0.5 + 1D / 8D, 0, 0.5, 0.5 + 1D / 8D, 0.5);
            addVertexWithTexture(0.5, 0, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D);
            addVertexWithTexture(0.5 - 1D / 8D, 0, 0.5, 0.5 - 1D / 8D, 0.5);
            GL11.glNormal3d(0, 1, 0);
            // Top
            addVertexWithTexture(0.5, 1D / 16D, 2D / 16D, 0.5, 1D / 16D);
            addVertexWithTexture(0.5 - 1D / 8D, 1D / 16D, 0.5, 0.5 - 1D / 8D, 0.5);
            addVertexWithTexture(0.5, 1D / 16D, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D);
            addVertexWithTexture(0.5 + 1D / 8D, 1D / 16D, 0.5, 0.5 + 1D / 8D, 0.5);
            GL11.glNormal3d(1, 0, 0);
            // Side 1
            addVertexWithTexture(0.5, 1D / 16D, 2D / 16D, 0.5, 1D / 16D);
            addVertexWithTexture(0.5, 0, 2D / 16D, 0.5, 1D / 16D);
            addVertexWithTexture(0.5 - 1D / 8D, 0, 0.5, 0.5 - 1D / 8D, 0.5);
            addVertexWithTexture(0.5 - 1D / 8D, 1D / 16D, 0.5, 0.5 - 1D / 8D, 0.5);
            // Side 2
            addVertexWithTexture(0.5 - 1D / 8D, 1D / 16D, 0.5, 0.5 - 1D / 8D, 0.5);
            addVertexWithTexture(0.5 - 1D / 8D, 0, 0.5, 0.5 - 1D / 8D, 0.5);
            addVertexWithTexture(0.5, 0, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D);
            addVertexWithTexture(0.5, 1D / 16D, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D);
            GL11.glNormal3d(-1, 0, 0);
            // Side 3
            addVertexWithTexture(0.5, 1D / 16D, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D);
            addVertexWithTexture(0.5, 0, 0.5 + 1D / 8D, 0.5, 0.5 + 1D / 8D);
            addVertexWithTexture(0.5 + 1D / 8D, 0, 0.5, 0.5 + 1D / 8D, 0.5);
            addVertexWithTexture(0.5 + 1D / 8D, 1D / 16D, 0.5, 0.5 + 1D / 8D, 0.5);
            // Side 4
            addVertexWithTexture(0.5 + 1D / 8D, 1D / 16D, 0.5, 0.5 + 1D / 8D, 0.5);
            addVertexWithTexture(0.5 + 1D / 8D, 0, 0.5, 0.5 + 1D / 8D, 0.5);
            addVertexWithTexture(0.5, 0, 2D / 16D, 0.5, 1D / 16D);
            addVertexWithTexture(0.5, 1D / 16D, 2D / 16D, 0.5, 1D / 16D);
        }
        GL11.glEnd();

    }
    GL11.glPopMatrix();

}

From source file:com.bluepowermod.client.render.RenderWindmill.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8) {
    TileWindmill mill = (TileWindmill) tile.getWorldObj().getTileEntity(tile.xCoord, tile.yCoord, tile.zCoord);

    GL11.glPushMatrix();//ww w.  ja  va  2s .com
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glTranslated(x + .5, y, z + .5);
    GL11.glScaled(.15, .15, .15);
    this.bindTexture(textureLocation);

    GL11.glRotated(mill.turbineTick, 0, 1, 0);
    model.renderAll();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.part.tube.Accelerator.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)//from ww  w  . j av a 2 s.c  o m
public void renderDynamic(Vec3d loc, double delta, int pass) {

    super.renderDynamic(loc, delta, pass);
    if (pass == 0) {
        Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
        Tessellator t = Tessellator.instance;

        GL11.glPushMatrix();
        GL11.glTranslatef((float) loc.getX() + 0.5F, (float) loc.getY() + 0.5F, (float) loc.getZ() + 0.5F);
        if (rotation == ForgeDirection.NORTH || rotation == ForgeDirection.SOUTH) {
            GL11.glRotated(90, 1, 0, 0);
        } else if (rotation == ForgeDirection.EAST || rotation == ForgeDirection.WEST) {
            GL11.glRotated(90, 0, 0, 1);
        }
        GL11.glTranslatef((float) -loc.getX() - 0.5F, (float) -loc.getY() - 0.5F, (float) -loc.getZ() - 0.5F);

        t.startDrawingQuads();

        t.setColorOpaque_F(1, 1, 1);
        t.addTranslation((float) loc.getX(), (float) loc.getY(), (float) loc.getZ());

        IIcon icon = isPowered() ? IconSupplier.acceleratorFrontPowered : IconSupplier.acceleratorFront;

        double minX = icon.getInterpolatedU(0);
        double maxX = icon.getInterpolatedU(16);
        double minY = icon.getInterpolatedV(0);
        double maxY = icon.getInterpolatedV(16);

        t.setNormal(0, -1, 0);
        t.addVertexWithUV(0, 4 / 16D, 0, maxX, maxY);// minY
        t.addVertexWithUV(1, 4 / 16D, 0, minX, maxY);
        t.addVertexWithUV(1, 4 / 16D, 1, minX, minY);
        t.addVertexWithUV(0, 4 / 16D, 1, maxX, minY);

        t.setNormal(0, 1, 1);
        t.addVertexWithUV(0, 12 / 16D, 0, maxX, maxY);// maxY
        t.addVertexWithUV(0, 12 / 16D, 1, minX, maxY);
        t.addVertexWithUV(1, 12 / 16D, 1, minX, minY);
        t.addVertexWithUV(1, 12 / 16D, 0, maxX, minY);

        icon = isPowered() ? IconSupplier.acceleratorSidePowered : IconSupplier.acceleratorSide;

        minX = icon.getInterpolatedU(4);
        maxX = icon.getInterpolatedU(12);
        minY = icon.getInterpolatedV(0);
        maxY = icon.getInterpolatedV(16);

        t.setNormal(0, 0, 1);
        t.addVertexWithUV(0, 4 / 16D, 1, maxX, minY);// maxZ
        t.addVertexWithUV(1, 4 / 16D, 1, maxX, maxY);
        t.addVertexWithUV(1, 12 / 16D, 1, minX, maxY);
        t.addVertexWithUV(0, 12 / 16D, 1, minX, minY);

        t.setNormal(0, 0, -1);
        t.addVertexWithUV(0, 4 / 16D, 0, minX, maxY);// minZ
        t.addVertexWithUV(0, 12 / 16D, 0, maxX, maxY);
        t.addVertexWithUV(1, 12 / 16D, 0, maxX, minY);
        t.addVertexWithUV(1, 4 / 16D, 0, minX, minY);

        t.setNormal(-1, 0, 0);
        t.addVertexWithUV(0, 4 / 16D, 0, maxX, minY);// minX
        t.addVertexWithUV(0, 4 / 16D, 1, maxX, maxY);
        t.addVertexWithUV(0, 12 / 16D, 1, minX, maxY);
        t.addVertexWithUV(0, 12 / 16D, 0, minX, minY);

        t.setNormal(1, 0, 0);
        t.addVertexWithUV(1, 4 / 16D, 0, maxX, maxY);// maxX
        t.addVertexWithUV(1, 12 / 16D, 0, minX, maxY);
        t.addVertexWithUV(1, 12 / 16D, 1, minX, minY);
        t.addVertexWithUV(1, 4 / 16D, 1, maxX, minY);

        icon = IconSupplier.acceleratorInside;

        minX = icon.getInterpolatedU(4);
        maxX = icon.getInterpolatedU(12);
        minY = icon.getInterpolatedV(4);
        maxY = icon.getInterpolatedV(12);

        t.addVertexWithUV(0, 4 / 16D, 6 / 16D, minX, minY);// inside maxZ
        t.addVertexWithUV(1, 4 / 16D, 6 / 16D, maxX, maxY);
        t.addVertexWithUV(1, 12 / 16D, 6 / 16D, maxX, maxY);
        t.addVertexWithUV(0, 12 / 16D, 6 / 16D, minX, minY);

        t.addVertexWithUV(0, 4 / 16D, 10 / 16D, minX, maxY);// inside minZ
        t.addVertexWithUV(0, 12 / 16D, 10 / 16D, minX, minY);
        t.addVertexWithUV(1, 12 / 16D, 10 / 16D, maxX, minY);
        t.addVertexWithUV(1, 4 / 16D, 10 / 16D, maxX, maxY);

        t.addVertexWithUV(10 / 16D, 4 / 16D, 0, minX, minY);// inside minX
        t.addVertexWithUV(10 / 16D, 4 / 16D, 1, maxX, maxY);
        t.addVertexWithUV(10 / 16D, 12 / 16D, 1, maxX, maxY);
        t.addVertexWithUV(10 / 16D, 12 / 16D, 0, minX, minY);

        t.addVertexWithUV(6 / 16D, 4 / 16D, 0, minX, minY);// inside maxX
        t.addVertexWithUV(6 / 16D, 12 / 16D, 0, minX, maxY);
        t.addVertexWithUV(6 / 16D, 12 / 16D, 1, maxX, maxY);
        t.addVertexWithUV(6 / 16D, 4 / 16D, 1, maxX, minY);

        t.addTranslation((float) -loc.getX(), (float) -loc.getY(), (float) -loc.getZ());
        t.draw();
        GL11.glPopMatrix();
    }

}

From source file:com.bluepowermod.part.tube.MagTube.java

License:Open Source License

/**
 * Render method that works, and now should be buried under the ground so no-one looks at it
 *///from   ww  w. ja va  2 s  .  c o m
@Override
@SideOnly(Side.CLIENT)
protected void renderSide() {

    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    Tessellator t = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    if (getParent() == null || getWorld() == null) {

    } else {
        if (connections[2]) {
            GL11.glRotated(90, 1, 0, 0);
        } else if (connections[4]) {
            GL11.glRotated(90, 0, 0, 1);
        }
    }
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    t.startDrawingQuads();

    double min = 2 / 16D;
    double max = 14 / 16D;
    double inMin = 12.001 / 16D;
    double inMax = 3.999 / 16D;

    IIcon icon = IconSupplier.magCoilSide;

    double minX = icon.getInterpolatedU(min * 16);
    double maxX = icon.getInterpolatedU(max * 16);
    double minY = icon.getInterpolatedV(min * 16);
    double maxY = icon.getInterpolatedV(max * 16);

    t.setNormal(0, 0, 1);
    t.addVertexWithUV(min, min, max, maxX, maxY);// maxZ
    t.addVertexWithUV(max, min, max, minX, maxY);
    t.addVertexWithUV(max, max, max, minX, minY);
    t.addVertexWithUV(min, max, max, maxX, minY);

    t.addVertexWithUV(min, min, inMax, maxX, maxY);// inside maxZ
    t.addVertexWithUV(max, min, inMax, minX, maxY);
    t.addVertexWithUV(max, max, inMax, minX, minY);
    t.addVertexWithUV(min, max, inMax, maxX, minY);

    t.setNormal(0, 0, -1);
    t.addVertexWithUV(min, min, min, minX, maxY);// minZ
    t.addVertexWithUV(min, max, min, minX, minY);
    t.addVertexWithUV(max, max, min, maxX, minY);
    t.addVertexWithUV(max, min, min, maxX, maxY);

    t.addVertexWithUV(min, min, inMin, maxX, maxY);// inside minZ
    t.addVertexWithUV(min, max, inMin, minX, minY);
    t.addVertexWithUV(max, max, inMin, minX, minY);
    t.addVertexWithUV(max, min, inMin, maxX, maxY);

    t.setNormal(-1, 0, 0);
    t.addVertexWithUV(min, min, min, maxX, maxY);// minX
    t.addVertexWithUV(min, min, max, minX, maxY);
    t.addVertexWithUV(min, max, max, minX, minY);
    t.addVertexWithUV(min, max, min, maxX, minY);

    t.addVertexWithUV(inMin, min, min, maxX, maxY);// inside minX
    t.addVertexWithUV(inMin, min, max, minX, maxY);
    t.addVertexWithUV(inMin, max, max, minX, minY);
    t.addVertexWithUV(inMin, max, min, maxX, minY);

    t.setNormal(1, 0, 0);
    t.addVertexWithUV(max, min, min, minX, minY);// maxX
    t.addVertexWithUV(max, max, min, minX, maxY);
    t.addVertexWithUV(max, max, max, maxX, maxY);
    t.addVertexWithUV(max, min, max, maxX, minY);

    t.addVertexWithUV(inMax, min, min, maxX, minY);// maxX
    t.addVertexWithUV(inMax, max, min, minX, maxY);
    t.addVertexWithUV(inMax, max, max, minX, maxY);
    t.addVertexWithUV(inMax, min, max, maxX, minY);

    icon = IconSupplier.magCoilFront;
    minX = icon.getInterpolatedU(min * 16);
    maxX = icon.getInterpolatedU(max * 16);
    minY = icon.getInterpolatedV(min * 16);
    maxY = icon.getInterpolatedV(max * 16);
    for (int i = 2; i < 16; i += 8) {
        t.setNormal(0, 1, 0);
        t.addVertexWithUV(min, 1 - i / 16D, min, maxX, maxY);// maxY
        t.addVertexWithUV(min, 1 - i / 16D, max, minX, maxY);
        t.addVertexWithUV(max, 1 - i / 16D, max, minX, minY);
        t.addVertexWithUV(max, 1 - i / 16D, min, maxX, minY);

        t.setNormal(0, -1, 0);
        t.addVertexWithUV(min, i / 16D, min, maxX, maxY);// minY
        t.addVertexWithUV(max, i / 16D, min, minX, maxY);
        t.addVertexWithUV(max, i / 16D, max, minX, minY);
        t.addVertexWithUV(min, i / 16D, max, maxX, minY);
    }
    t.draw();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.assemblyline.content.inserter.TileInsertArmClient.java

@Override
@SideOnly(Side.CLIENT)/*  w w  w .  j ava2 s  .co  m*/
public void renderDynamic(Pos pos, float deltaFrame, int pass) {
    if (ticks < 2) {
        renderAngle.set(rotation);
    } else {
        renderAngle.lerp(rotation, deltaFrame).clampTo360();
    }
    float yaw = (float) renderAngle.yaw();

    //Render inserter
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.4f, pos.zf() + 0.5f);
    GL11.glRotated(yaw, 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAllExcept("Base", "BaseTop");
    GL11.glPopMatrix();

    //-----------------------------
    //Render item in hand
    GL11.glPushMatrix();
    GL11.glTranslated(pos.xf() + 0.5f, pos.yf() + 0.2f, pos.zf() + 0.5f);

    //Setup world position
    double x = renderAngle.x() * 1.15;
    double z = renderAngle.z() * 1.15;
    FakeItemRender.setWorldPosition(worldObj, xi() + 0.5 + x, yi() + 0.5, zi() + 0.5 + z);

    //Render actual item with rotation
    yaw += 90f;
    GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F);
    FakeItemRender.renderItemAtPosition(1, 0, 0, renderStack);
    GL11.glPopMatrix();
}