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:info.plugmania.novacraft.event.gui.Render3DOverlayEvent.java

License:GNU General Public License

public void drawCylinder(Position position, float radius, int slices, int stacks, float lineWidth, int colour) {
    float red = (float) (colour >> 24 & 255) / 255.0F;
    float green = (float) (colour >> 16 & 255) / 255.0F;
    float blue = (float) (colour >> 8 & 255) / 255.0F;
    float alpha = (float) (colour & 255) / 255.0F;
    Cylinder cylinder = new Cylinder();
    enable();// w w w . j a  va  2 s .  c o m
    GL11.glColor4f(red, green, blue, alpha);
    GL11.glTranslated(position.getX() - p.posX, position.getY() - p.posY, position.getZ() - p.posZ);
    GL11.glRotatef(600F, 1, 1, 1);
    GL11.glLineWidth(lineWidth);
    cylinder.setDrawStyle(GLU.GLU_SILHOUETTE);
    cylinder.draw(radius, radius, 2F, slices, stacks);
    disable();

}

From source file:info.plugmania.novacraft.event.gui.Render3DOverlayEvent.java

License:GNU General Public License

public void drawSphere(Position position, float size, int slices, int stacks, float lineWidth, int colour) {
    float red = (float) (colour >> 24 & 255) / 255.0F;
    float green = (float) (colour >> 16 & 255) / 255.0F;
    float blue = (float) (colour >> 8 & 255) / 255.0F;
    float alpha = (float) (colour & 255) / 255.0F;
    Sphere sphere = new Sphere();
    enable();/*from  w  w w . jav a 2s.  co  m*/
    GL11.glColor4f(red, green, blue, alpha);
    GL11.glTranslated(position.getX() - p.posX, position.getY() - p.posY, position.getZ() - p.posZ);
    GL11.glRotatef(600F, 1, 1, 1);
    GL11.glLineWidth(lineWidth);
    sphere.setDrawStyle(GLU.GLU_SILHOUETTE);
    sphere.draw(size, slices, stacks);
    disable();
}

From source file:io.cyb3rwarri0r8.ccuuid.lib.RenderingHelper.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    if (block == ModBlocks.ccuuidGenerator) {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(new UUIDGenerator(), 0.0D, 0.0D, 0.0D, 0.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    }/*  w  w w.  j  ava  2s . co  m*/
}

From source file:io.cyb3rwarri0r8.ccuuid.render.RenderUUIDGenerator.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float par5) {
    /*GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0F, 1F);/*from   www.  j  a va 2s .com*/
    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
    */
    UUIDGenerator generator = (UUIDGenerator) tileEntity;
    //The PushMatrix tells the renderer to "start" doing something.
    GL11.glPushMatrix();
    //This is setting the initial location.
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

    ResourceLocation textures = (new ResourceLocation("ccuuid:textures/blocks/texture.png"));

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

    //This rotation part is very important! Without it, your model will render upside-down! And for some reason you DO need PushMatrix again!
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    int placing = (generator.getFacing() + 1) * 90;
    GL11.glPopMatrix();
    GL11.glRotatef(placing, 0, 1, 0);
    GL11.glPopMatrix();

}

From source file:io.cyb3rwarri0r8.commumod.client.renderer.ModularPickaxeItemRenderer.java

License:Open Source License

/**
 * Called to do the actual rendering, see ItemRenderType for details on when specific
 * types are run, and what extra data is passed into the data parameter.
 *
 * @param type The render type//from w ww . j a  v  a2s  .  c o  m
 * @param item The ItemStack being rendered
 * @param data Extra Type specific data
 */
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        if (!(item.getItem() instanceof ItemModularPickaxe)) {
            return;
        }

        ItemModularPickaxe modularPickaxe = (ItemModularPickaxe) item.getItem();

        EntityPlayer entityPlayer = (EntityPlayer) data[1];

        float i2 = 0.0F;
        float translation = -1.5F;

        if ((entityPlayer.inventory.getCurrentItem() == null)
                || (!(entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemModularPickaxe))) {
            return;
        }

        GL11.glPushMatrix();
        if (i2 < 0.0F) {
            i2 = 0.0F;
        }

        if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
            GL11.glTranslatef(0.0F, -(Math.abs(i2) / 2.0F), 0.0F);
            if (entityPlayer.getItemInUseCount() > 0) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(-77.0F, 0.0F, 0.0F, 1.0F);
                GL11.glRotatef(-44.0F, 0.0F, 1.0F, 0.0F);
                GL11.glTranslatef(-0.9F, -1.2F, -0.85F);
                GL11.glRotatef(15.0F, 0.0F, 0.0F, 1.0F);
                GL11.glTranslatef(0.1F, -0.25F, 0.08F);
            }

            if (entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemModularPickaxe) {
                GL11.glRotatef(10.0F, 0.0F, 0.0F, 0.0F);
                GL11.glTranslatef(0.3F, 0.515F, 0.5F);
            }
        } else {
            GL11.glTranslatef(0.7F, 0.225F, 0.6125F);
            GL11.glRotatef(-40.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-110.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.1F, -0.9F, 0.15F);
            GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(1.3F, 1.3F, 1.3F);
        }

        renderItemCustom(type, item, data);
        GL11.glPopMatrix();
        GL11.glPushMatrix();

        float f28 = item.getMaxItemUseDuration() - (entityPlayer.getItemInUseCount() - 1.0F + 1.0F);
        float f32 = f28 / 50.0F;
        f32 = (f32 * f32 + f32 * 2.0F) / 3.0F;

        if (f32 > 1.0F) {
            f32 = 1.0F;
        }

        if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
            GL11.glRotatef(-330.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(1.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0F, 0.5F, 0.15F);
            GL11.glTranslatef(0.0F, 0.05F, -0.25F);
            GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(331.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(2.0F, 1.0F, 0.0F, 1.0F);
            GL11.glScalef(0.7F, 0.7F, 0.7F);

            if (entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemModularPickaxe) {
                GL11.glRotatef(83.0F, 1.0F, 0.0F, 0.0F);
                GL11.glRotatef(-62.0F, 0.0F, 0.0F, 1.0F);
                GL11.glRotatef(-45.0F, 0.0F, 1.0F, 0.0F);
                GL11.glTranslatef(-1.5F, -1.22F, -0.7F);
            }
        } else {
            GL11.glTranslatef(0.7F, 0.225F, 0.6125F);
            GL11.glRotatef(-40.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-110.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.05F, -0.7F, 0.15F);
            GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(1.3F, 1.3F, 1.3F);
        }
        GL11.glPopMatrix();
    }

}

From source file:io.cyb3rwarri0r8.commumod.client.renderer.ModularPickaxeItemRenderer.java

License:Open Source License

private void renderItemCustom(ItemRenderType type, ItemStack item, Object[] data) {
    int i = 0;/*from  w  w w .  ja v  a 2  s .  com*/
    EntityLivingBase entity = (EntityLivingBase) data[1];
    GL11.glPushMatrix();

    Tessellator tes = Tessellator.instance;
    IIcon icon = entity.getItemIcon(item, i);

    float f = ((IIcon) icon).getMinU();
    float f1 = ((IIcon) icon).getMaxU();
    float f2 = ((IIcon) icon).getMinV();
    float f3 = ((IIcon) icon).getMaxV();

    float j = 0.1F;
    float l = 0.3F;
    GL11.glEnable(32826);
    GL11.glTranslatef(-j, -l, 0.0F);
    float m = 1.5F;
    GL11.glScalef(m, m, m);
    GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(330.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
    ItemRenderer.renderItemIn2D(tes, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

    GL11.glDisable(32826);

    GL11.glPopMatrix();
}

From source file:io.cyb3rwarri0r8.commumod.entity.render.RenderCobaltBoat.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *///from   w ww.j a  v a  2s  .  com
public void doRender(EntityCobaltBoat p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_);
    GL11.glRotatef(180.0F - p_76986_8_, 0.0F, 1.0F, 0.0F);
    float f2 = (float) p_76986_1_.getTimeSinceHit() - p_76986_9_;
    float f3 = p_76986_1_.getDamageTaken() - p_76986_9_;

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

    if (f2 > 0.0F) {
        GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float) p_76986_1_.getForwardDirection(), 1.0F,
                0.0F, 0.0F);
    }

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

From source file:io.cyb3rwarri0r8.commumod.entity.render.RenderSuperbiumGolem.java

License:Open Source License

protected void rotateCorpse(EntitySuperbiumGolem p_77043_1_, float p_77043_2_, float p_77043_3_,
        float p_77043_4_) {
    super.rotateCorpse(p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_);

    if ((double) p_77043_1_.limbSwingAmount >= 0.01D) {
        float f3 = 13.0F;
        float f4 = p_77043_1_.limbSwing - p_77043_1_.limbSwingAmount * (1.0F - p_77043_4_) + 6.0F;
        float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F);
        GL11.glRotatef(6.5F * f5, 0.0F, 0.0F, 1.0F);
    }// ww w. ja  v  a  2s  . c om
}

From source file:io.cyb3rwarri0r8.commumod.entity.render.RenderSuperbiumGolem.java

License:Open Source License

protected void renderEquippedItems(EntitySuperbiumGolem p_77029_1_, float p_77029_2_) {
    //        super.renderEquippedItems(p_77029_1_, p_77029_2_);

    if (p_77029_1_.getHoldRoseTick() != 0) {
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glPushMatrix();/*from w  w w  . jav a2s  .  c om*/
        GL11.glRotatef(
                5.0F + 180.0F * this.superbiumGolemModel.superbiumGolemRightArm.rotateAngleX / (float) Math.PI,
                1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(-0.6875F, 1.25F, -0.9375F);
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        float f1 = 0.8F;
        GL11.glScalef(f1, -f1, f1);
        int i = p_77029_1_.getBrightnessForRender(p_77029_2_);
        int j = i % 65536;
        int k = i / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.bindTexture(TextureMap.locationBlocksTexture);
        //            this.(Blocks.red_flower, 0, 1.0F);
        GL11.glPopMatrix();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }
}

From source file:io.flob.blackheart.IMob.java

License:Open Source License

public void _look_through() {
    GL11.glLoadIdentity();/*from   w w w. ja  va2 s .c  o m*/
    GL11.glRotatef(pitch, 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(yaw, 0.0f, 1.0f, 0.0f);
    float off_set = 0F;
    if (moving) {
        off_set = -bias - (Level.grid_size / 50);
    }
    GL11.glTranslatef(-camera().getX(), -camera().getY() - off_set, -camera().getZ());
}