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:de.paleocrafter.pcraft.client.renderer.item.ItemMachineRenderer.java

License:LGPL

private void renderMicroscope(float x, float y, float z) {

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_MICROSCOPE);
    GL11.glPushMatrix(); // start
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(x, y, z); // size
    GL11.glScalef(0.5F, 0.5F, 0.5F);/*www  . ja v  a 2  s  . com*/
    GL11.glRotatef(180, 1, 0, 0);
    modelMicroscope.renderAll();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix(); // end
}

From source file:de.paleocrafter.pcraft.client.renderer.tileentity.TileEntityMachineRenderer.java

License:LGPL

private void renderAnalyzer(TileAnalyzer te, double x, double y, double z) {
    GL11.glPushMatrix();//  w  ww  .j  a  v  a 2 s. com
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef((float) x, (float) y + 2.0F, (float) z + 1.0F);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

    ForgeDirection direction = te.getOrientation();
    short angle = 0;

    if (direction != null) {
        if (direction == ForgeDirection.NORTH) {
            angle = 0;
        } else if (direction == ForgeDirection.SOUTH) {
            angle = 180;
        } else if (direction == ForgeDirection.WEST) {
            angle = -90;
        } else if (direction == ForgeDirection.EAST) {
            angle = 90;
        }
    }

    GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ANALYZER);
    modelAnalyzer.renderAll((int) Math.ceil(te.getProgress() / 10));
    if (te.getState() == 1) {
        FMLClientHandler.instance().getClient().renderEngine
                .bindTexture(Textures.MODEL_LASER + ((int) Math.ceil(te.getProgress() / 10)) + ".png");
        ModelRenderer laser = new ModelRenderer(modelAnalyzer, 0, 0);
        laser.addBox(-0.5F, 12.5F, -0.5F, 1, 10, 1);
        laser.setRotationPoint(0F, 0F, 0F);
        if (delta >= 0.9F) {
            Random rand = new Random();
            float val = 1F;
            float rotX = 0;
            float rotZ = 0;
            while (val > 0.07F) {
                val = rand.nextFloat();
            }
            rotX = val;
            val = 1F;
            while (val > 0.09F) {
                val = rand.nextFloat();
            }
            rotZ = val;
            switch (rand.nextInt(4)) {
            case 0:
                rotZ *= -1;
                break;
            case 1:
                rotX *= -1;
                break;
            case 3:
            case 4:
                rotX *= -1;
                rotZ *= -1;
                break;
            }
            te.setLaserRotX(rotX);
            te.setLaserRotZ(rotZ);
        }
        setRotation(laser, te.getLaserRotX(), 0F, te.getLaserRotZ());
        laser.setTextureSize(64, 32);
        laser.mirror = true;
        if (te.getFuelLevel() >= 2) {
            laser.render(0.0625F);
        }
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_FOSSIL);
        GL11.glTranslatef(-0.475F, 1.42F, 0.165F);
        GL11.glScalef(0.08F, 0.08F, 0.08F);
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        new ModelFossil().render();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:de.paleocrafter.pcraft.client.renderer.tileentity.TileEntityMachineRenderer.java

License:LGPL

private void renderMicroscope(TileMicroscope te, double x, double y, double z) {
    GL11.glPushMatrix();/*from w  ww  .  j  a v a 2 s .c o  m*/
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef((float) x, (float) y + 2.0F, (float) z + 1.0F);
    GL11.glScalef(0.5F, -0.5F, -0.5F);
    GL11.glTranslatef(1F, 1F, 1F);

    ForgeDirection direction = te.getOrientation();
    short angle = 0;

    if (direction != null) {
        if (direction == ForgeDirection.NORTH) {
            angle = -90;
        } else if (direction == ForgeDirection.SOUTH) {
            angle = 90;
        } else if (direction == ForgeDirection.WEST) {
            angle = 180;
        } else if (direction == ForgeDirection.EAST) {
            angle = 0;
        }
    }

    GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_MICROSCOPE);
    modelMicroscope.renderAll();

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:de.sanandrew.core.manpack.mod.client.render.RenderSanPlayer.java

License:Creative Commons License

@Override
protected void renderEquippedItems(AbstractClientPlayer player, float partTicks) {
    super.renderEquippedItems(player, partTicks);

    GL11.glPushMatrix();/*from ww  w  .  ja v  a  2s.co m*/
    this.myModel.body.postRender(0.0625F);
    ItemStack slot = player.inventory.getStackInSlot(0);
    if (slot != null && slot != player.getCurrentEquippedItem()) {
        GL11.glPushMatrix();
        GL11.glRotatef(-80.0F, 0.0F, 0.0F, 1.0F);
        GL11.glScalef(0.6F, 0.6F, 0.6F);
        GL11.glTranslatef(-1.0F, -0.4F, 0.3F);
        ItemRenderHelper.renderItemIn3D(slot);
        GL11.glPopMatrix();
        GL11.glTranslatef(0.0F, 0.0F, 0.05F);
    }

    slot = player.inventory.getStackInSlot(1);
    if (slot != null && slot != player.getCurrentEquippedItem()) {
        GL11.glPushMatrix();
        GL11.glRotatef(-10.0F, 0.0F, 0.0F, 1.0F);
        GL11.glScalef(0.6F, 0.6F, 0.6F);
        GL11.glTranslatef(-0.6F, -0.0F, 0.3F);
        ItemRenderHelper.renderItemIn3D(slot);
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

/**
 * Renders an IIcon instance in 3D./*  w w w .  j a v  a2  s  .  c  om*/
 *
 * @param icon     the icon to be rendered
 * @param isBlock  if it should be rendered as a block or not
 * @param hasAlpha if it has a transparent texture
 * @param color    the tint it should be rendered in
 */
public static void renderIconIn3D(IIcon icon, boolean isBlock, boolean hasAlpha, int color) {
    GL11.glPushMatrix();

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    if (isBlock) {
        Minecraft.getMinecraft().renderEngine
                .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(0));
        if (hasAlpha) {
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        }

        GL11.glTranslatef(0.5F, 0.5F, 0.0F);
        GL11.glScalef(0.5F, 0.5F, 0.5F);

        GL11.glPushMatrix();

        Tessellator tessellator = Tessellator.instance;

        float red = (color >> 16 & 255) / 255.0F;
        float green = (color >> 8 & 255) / 255.0F;
        float blue = (color & 255) / 255.0F;
        GL11.glColor4f(red, green, blue, 1.0F);

        Blocks.stone.setBlockBoundsForItemRender();
        renderBlocksRi.setRenderBoundsFromBlock(Blocks.stone);
        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, -1.0F, 0.0F);
        renderBlocksRi.renderFaceYNeg(Blocks.stone, 0.0D, 0.0D, 0.0D, icon);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
        renderBlocksRi.renderFaceYPos(Blocks.stone, 0.0D, 0.0D, 0.0D, icon);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 0.0F, -1.0F);
        renderBlocksRi.renderFaceZNeg(Blocks.stone, 0.0D, 0.0D, 0.0D, icon);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 0.0F, 1.0F);
        renderBlocksRi.renderFaceZPos(Blocks.stone, 0.0D, 0.0D, 0.0D, icon);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(-1.0F, 0.0F, 0.0F);
        renderBlocksRi.renderFaceXNeg(Blocks.stone, 0.0D, 0.0D, 0.0D, icon);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.setNormal(1.0F, 0.0F, 0.0F);
        renderBlocksRi.renderFaceXPos(Blocks.stone, 0.0D, 0.0D, 0.0D, icon);
        tessellator.draw();

        GL11.glPopMatrix();

        if (hasAlpha) {
            GL11.glDisable(GL11.GL_BLEND);
        }
    } else {
        if (hasAlpha) {
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        }

        float red = (color >> 16 & 255) / 255.0F;
        float green = (color >> 8 & 255) / 255.0F;
        float blue = (color & 255) / 255.0F;
        GL11.glColor4f(red, green, blue, 1.0F);
        renderItemIn3D(icon, false, 1);

        if (hasAlpha) {
            GL11.glDisable(GL11.GL_BLEND);
        }
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    TextureUtil.func_147945_b();
}

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

private static void renderItemIn3D(IIcon icon, boolean withEffect, int spriteIndex) {
    GL11.glPushMatrix();/*from  w  w w . j a va2s  .c o  m*/

    if (icon == null) {
        GL11.glPopMatrix();
        return;
    }

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();

    Tessellator tessellator = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine
            .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex));

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F,
            false);

    if (withEffect) {
        float baseClr = 0.76F;
        float glintScale = 0.125F;
        float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;

        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);

        Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);
        GL11.glTranslatef(glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);

        glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;

        GL11.glTranslatef(-glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

/**
 * Renders an IIcon in 2D./*from w  ww  .ja v a 2 s . c  o m*/
 *
 * @param icon        the icon to be rendered
 * @param spriteIndex the index of the texture to be used (0 = blocks, 1 = items)
 * @param hasEffect   if it has an enchantment effect
 * @param isGlowing   if it should glow in the dark
 */
public static void renderIcon(IIcon icon, int spriteIndex, boolean hasEffect, boolean isGlowing) {
    GL11.glPushMatrix();

    if (icon == null) {
        GL11.glPopMatrix();
        return;
    }

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();
    float transX = 0.0F;
    float transY = 0.3F;
    float scale = 1.5F;
    Tessellator tessellator = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine
            .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex));

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-transX, -transY, 0.0F);
    GL11.glScalef(scale, scale, scale);
    GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);

    renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F,
            isGlowing);

    if (hasEffect) {
        float baseClr = 0.76F;
        float glintScale = 0.125F;
        float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;

        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);

        Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);
        GL11.glTranslatef(glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);

        glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;

        GL11.glTranslatef(-glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.betterboat.client.RenderBetterBoat.java

License:Creative Commons License

public void doRender(EntityBetterBoat boat, double x, double y, double z, float yaw, float partTicks) {
    GL11.glPushMatrix();//from   ww w . ja  v a  2 s  .  com
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F);
    float timeSinceHit = (float) boat.getTimeSinceHit() - partTicks;
    float damageTaken = boat.getDamageTaken() - partTicks;

    if (damageTaken < 0.0F) {
        damageTaken = 0.0F;
    }

    if (timeSinceHit > 0.0F) {
        GL11.glRotatef(MathHelper.sin(timeSinceHit) * timeSinceHit * damageTaken / 10.0F
                * (float) boat.getForwardDirection(), 1.0F, 0.0F, 0.0F);
    }

    float scale = 0.75F;
    GL11.glScalef(scale, scale, scale);
    GL11.glScalef(1.0F / scale, 1.0F / scale, 1.0F / scale);
    this.bindEntityTexture(boat);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    this.modelBoat.render(boat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.event.SoldierBodyRenderHandler.java

License:Creative Commons License

private void renderFeather(EntityClayMan clayMan, RenderClayMan renderer) {
    GL11.glPushMatrix();//from   w  ww  .j  a va  2s.  c  o m
    renderer.modelBipedMain.bipedBody.postRender(0.0625F);
    GL11.glTranslatef(0.0F, -0.6F, 0.0F);

    float itemScale = 1.5F;
    GL11.glScalef(itemScale, itemScale, itemScale);
    GL11.glTranslatef(0.6F, 0.05F, 0.0F);
    GL11.glRotatef(22.5F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(90.0F, -1.0F, 0.0F, 1.0F);

    renderer.getItemRenderer().renderItem(clayMan, this.p_feather, 0);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.event.SoldierLeftHandRenderHandler.java

License:Creative Commons License

private static void renderLeftHandItem(EntityClayMan clayMan, RenderClayMan renderer, ItemStack stack) {
    GL11.glPushMatrix();//from  w w  w  .  ja  v a  2  s .  c  om
    renderer.modelBipedMain.bipedLeftArm.postRender(0.0625F);
    GL11.glTranslatef(-0.1F, 0.6F, 0.0F);

    float itemScale = 0.6F;
    GL11.glScalef(itemScale, itemScale, itemScale);
    GL11.glRotatef(140.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);

    renderer.getItemRenderer().renderItem(clayMan, stack, 0);
    GL11.glPopMatrix();
}