Example usage for org.lwjgl.opengl GL11 glRotatef

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

Introduction

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

Prototype

public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x,
        @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a rotation matrix.

Usage

From source file:lyonlancer5.pfsteel.world.dimension.yakusoku.YakusokuSkyRenderer.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)/*from   w w w. java2 s. c o m*/
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f4;
    if (mc.gameSettings.anaglyph) {
        float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        f4 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f5;
        f2 = f6;
        f3 = f4;
    }
    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks),
            partialTicks);
    float f7;
    float f8;
    float f9;
    float f10;
    if (afloat != null) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glPushMatrix();
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F,
                0.0F, 0.0F, 1.0F);
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        f4 = afloat[0];
        f7 = afloat[1];
        f8 = afloat[2];
        float f11;
        if (mc.gameSettings.anaglyph) {
            f9 = (f4 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
            f10 = (f4 * 30.0F + f7 * 70.0F) / 100.0F;
            f11 = (f4 * 30.0F + f8 * 70.0F) / 100.0F;
            f4 = f9;
            f7 = f10;
            f8 = f11;
        }
        tessellator1.startDrawing(6);
        tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]);
        tessellator1.addVertex(0.0D, 100.0D, 0.0D);
        byte b0 = 16;
        tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);
        for (int j = 0; j <= b0; ++j) {
            f11 = (float) j * (float) Math.PI * 2.0F / (float) b0;
            float f12 = MathHelper.sin(f11);
            float f13 = MathHelper.cos(f11);
            tessellator1.addVertex((double) (f12 * 120.0F), (double) (f13 * 120.0F),
                    (double) (-f13 * 40.0F * afloat[3]));
        }
        tessellator1.draw();
        GL11.glPopMatrix();
        GL11.glShadeModel(GL11.GL_FLAT);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    f4 = 1.0F - world.getRainStrength(partialTicks);
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);

    f10 = 20.0F; // Size of sun from center
    mc.renderEngine
            .bindTexture(new ResourceLocation(ModVersion.modid, "textures/environment/yakusoku_sun.png"));

    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV((double) (-f10), 100.0D, (double) (-f10), 0.0D, 0.0D);
    tessellator1.addVertexWithUV((double) f10, 100.0D, (double) (-f10), 1.0D, 0.0D);
    tessellator1.addVertexWithUV((double) f10, 100.0D, (double) f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV((double) (-f10), 100.0D, (double) f10, 0.0D, 1.0D);

    tessellator1.draw(); // Draw sun
    f10 = 15.0F; // Size of moon from center

    mc.renderEngine.bindTexture(
            new ResourceLocation(ModVersion.modid, "textures/environment/yakusoku_moon_phases.png"));

    int k = world.getMoonPhase();
    int l = k % 4;
    int i1 = k / 4 % 2;
    float f14 = (float) (l + 0) / 4.0F;
    float f15 = (float) (i1 + 0) / 2.0F;
    float f16 = (float) (l + 1) / 4.0F;
    float f17 = (float) (i1 + 1) / 2.0F;
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV((double) (-f10), -100.0D, (double) f10, (double) f16, (double) f17);
    tessellator1.addVertexWithUV((double) f10, -100.0D, (double) f10, (double) f14, (double) f17);
    tessellator1.addVertexWithUV((double) f10, -100.0D, (double) (-f10), (double) f14, (double) f15);
    tessellator1.addVertexWithUV((double) (-f10), -100.0D, (double) (-f10), (double) f16, (double) f15);
    tessellator1.draw();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float f18 = world.getStarBrightness(partialTicks) * f4;
    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starGLCallList);
    }
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();
    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex((double) (-f8), (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.draw();
    }
    if (world.provider.isSkyColored()) {
        GL11.glColor3f(0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
        //GL11.glColor3f(0.2F + 0.04F, f2 * 0.6F + 0.1F, f3 * 0.2F + 0.04F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:Main.Graphics.GameObject.java

public static void RenderGL() {

    float x = GameWorld.x;
    float y = GameWorld.y;
    float rotation = GameWorld.rotation;

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glColor3f(0.5f, 0.5f, 1.0f);//from  w ww. j  av  a 2s.  com

    GL11.glPushMatrix();
    GL11.glTranslatef(x, y, 0);
    GL11.glRotatef(rotation, 0f, 0f, 1f);
    GL11.glTranslatef(-x, -y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x - 50, y - 50);
    GL11.glVertex2f(x + 50, y - 50);
    GL11.glVertex2f(x + 50, y + 50);
    GL11.glVertex2f(x - 50, y + 50);
    GL11.glEnd();
    GL11.glPopMatrix();

}

From source file:makeo.gadomancy.client.renderers.entity.RenderGolemHelper.java

License:LGPL

public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
    GL11.glPushMatrix();/*from   ww w. j a  va2s  . c o  m*/

    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
    GL11.glScaled(0.175D, 0.175D, 0.175D);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    ItemStack coreItem = core.getItem();
    IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMinU();
    float f4 = icon.getMaxV();
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(),
            0.2F);

    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.entity.RenderGolemHelper.java

License:LGPL

public static void renderCarriedItemsFix(EntityGolemBase golem) {
    GL11.glPushMatrix();/*from  w  w w.  jav a  2  s. c om*/

    GL11.glScaled(0.4D, 0.4D, 0.4D);

    GL11.glTranslatef(-0.5F, 2.5F, -1.25F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);

    ItemStack item = golem.getCarriedForDisplay();

    int renderPass = 0;
    do {
        IIcon icon = item.getItem().getIcon(item, renderPass);
        if (icon != null) {
            Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
            GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());

            ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        renderPass++;
    } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));

    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.entity.RenderGolemHelper.java

License:LGPL

public static void renderToolItem(EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel,
        RenderManager renderManager) {/* ww w  .jav  a 2s.  c  o m*/
    GL11.glPushMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    float angle = (float) (0.195 * Math.PI / -1 * ((ModelGolem) mainModel).golemRightArm.rotateAngleX);

    float y = (float) (Math.cos(angle) * 1.15);
    float z = (float) (Math.sin(angle) * 1.15);

    GL11.glTranslatef(-0.25F, y, z * -0.5f);

    GL11.glRotated(angle / Math.PI * 180f, -1, 0, 0);

    float fs = 0.66F;
    GL11.glScalef(fs, fs, fs);

    net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient
            .getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
    boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(
            net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack,
            net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));

    Item item = itemstack.getItem();
    float f1;

    if (item instanceof ItemBlock
            && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) {
        f1 = 0.5F;
        GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
        f1 *= 0.75F;
        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(-f1, -f1, f1);
    } else if (item == Items.bow) {
        f1 = 0.625F;
        GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
        GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    } else if (item.isFull3D()) {
        f1 = 0.625F;

        if (item.shouldRotateAroundWhenRendering()) {
            GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.0F, -0.125F, 0.0F);
        }

        GL11.glTranslatef(0.0F, 0.1875F, 0.0F);

        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    } else {
        f1 = 0.375F;
        GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
        GL11.glScalef(f1, f1, f1);
        GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
    }

    float f2;
    int i;
    float f5;

    if (itemstack.getItem().requiresMultipleRenderPasses()) {
        for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) {
            int j = itemstack.getItem().getColorFromItemStack(itemstack, i);
            f5 = (float) (j >> 16 & 255) / 255.0F;
            f2 = (float) (j >> 8 & 255) / 255.0F;
            float f3 = (float) (j & 255) / 255.0F;
            GL11.glColor4f(f5, f2, f3, 1.0F);

            renderManager.itemRenderer.renderItem(golem, itemstack, i);
        }
    } else {
        i = itemstack.getItem().getColorFromItemStack(itemstack, 0);
        float f4 = (float) (i >> 16 & 255) / 255.0F;
        f5 = (float) (i >> 8 & 255) / 255.0F;
        f2 = (float) (i & 255) / 255.0F;
        GL11.glColor4f(f4, f5, f2, 1.0F);

        renderManager.itemRenderer.renderItem(golem, itemstack, 0);
    }

    GL11.glScaled(1.0D, 1.0D, 1.0D);

    GL11.glPopMatrix();
}

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

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    GL11.glPushMatrix();//from ww w .j a  v a 2 s. c  o  m

    GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5);

    int metadata = tile.getBlockMetadata();

    ForgeDirection side = ForgeDirection.getOrientation(metadata & 7);

    if (side == ForgeDirection.UP) {
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glTranslatef(0, -2, 0);
    } else if (side != ForgeDirection.DOWN) {
        GL11.glRotatef(-90, side.offsetZ, 0, -1 * side.offsetX);
        GL11.glTranslatef(side.offsetX, -1, side.offsetZ);
    }

    boolean flipped = (metadata & 8) == 8;
    if (side == ForgeDirection.WEST || side == ForgeDirection.EAST) {
        flipped = !flipped;
    }

    if (flipped) {
        GL11.glRotatef(90, 0, 1, 0);
    }

    bindTexture(RESOURCE);
    MODEL.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    renderBellow();
    GL11.glRotatef(180, 0, 1, 0);
    renderBellow();

    GL11.glPopMatrix();
}

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

License:LGPL

public void renderBellow() {
    GL11.glPushMatrix();//from   www. jav  a 2  s. co  m

    GL11.glTranslatef(0, 0.75f, 0.25f);
    GL11.glRotatef(90f, 0, 1, 0);
    GL11.glTranslatef(-0.05f, 0.03f, 0f);
    GL11.glScalef(0.6f, 0.44f, 0.55f);

    BELLOWS_RENDERER.renderEntityAt(BELLOWS_TILE, 0, 0, 0, 0);

    GL11.glPopMatrix();
}

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

License:LGPL

private void renderWand(ItemStack wandStack, float ticks) {
    GL11.glRotatef(((ticks / 3) / 20.0F) * (180F / (float) Math.PI), 0, 1f, 0);

    renderTopPart();/*from  w w  w.j  av a 2  s  .c o m*/

    if (wandStack != null && wandStack.stackSize > 0) {
        GL11.glPushMatrix();

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wandFocusStack = wandStack.copy();
        item.setFocus(wandFocusStack, new ItemStack(ConfigItems.itemFocusPrimal));

        GL11.glRotatef(180, 1, 0, 0);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0);

        GL11.glTranslatef(0, -1.4924f, 0);
        if (item.isStaff(wandFocusStack)) {
            GL11.glTranslatef(0, -0.5f, 0);

            STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        } else {
            WAND_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        }
        GL11.glPopMatrix();
    }
}

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

License:LGPL

private void renderSides(TileInfusionClaw tile, World world, int x, int y, int z, float elapsed) {
    GL11.glPushMatrix();/*from  w ww .  jav  a 2 s  .c  om*/

    float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[8]));
    if (tile.animationStates[8] > 0) {
        tile.animationStates[8] += elapsed;

        if (tile.animationStates[8] > 20 * 2.5f) {
            tile.animationStates[8] = -tile.animationStates[8];
            tile.animationStates[9] = 1;

            createSideZap(tile);
        }
    } else if (tile.animationStates[8] < 0) {
        tile.animationStates[8] += elapsed * 0.5;

        if (tile.animationStates[8] > 0) {
            tile.animationStates[8] = 0;
        }
    }

    for (int i = 0; i < 4; i++) {
        float heightMove = getNextMoveOffset(tile, i, speed, elapsed);
        float widthMove = getNextMoveOffset(tile, i + 4, speed, elapsed);

        ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
        boolean powered = world != null
                && world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0;

        GL11.glPushMatrix();

        GL11.glTranslatef(-dir.offsetZ * widthMove, heightMove, -dir.offsetX * widthMove);
        GL11.glTranslated((0.5 - (1f / 16f * 0.75)) * dir.offsetX, 0, (0.5 - (1f / 16f * 0.75)) * dir.offsetZ);
        GL11.glRotatef(90, -1 * dir.offsetZ, 0, dir.offsetX);

        GL11.glScalef(0.75f, 0.75f, 0.75f);

        renderRedstonePart(powered);

        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}

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

License:LGPL

public void renderTileEntityAt(TileManipulationFocus tile, double x, double y, double z, float partialTicks) {
    GL11.glPushMatrix();/*from  w  w  w  . j ava  2s. co  m*/
    GL11.glTranslated(x, y, z);

    bindTexture(new SimpleResourceLocation("models/manipulation_focus_" + tile.fociId + ".png"));

    GL11.glRotatef(180, 1, 0, 0);
    GL11.glTranslatef(0.5f, -1.5f + (2 / 16f), -0.5f);

    if (tile.fociId == 0) {
        GL11.glPushMatrix();
        for (int i = 0; i < 4; i++) {
            RANDOM_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f);
            GL11.glRotatef(90, 0, 1, 0);
        }
        GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
}