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:appeng.parts.reporting.AbstractPartMonitor.java

License:Open Source License

private void tesrRenderScreen(final Tessellator tess, final IAEItemStack ais) {
    // GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );

    final ForgeDirection d = this.getSide();

    GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);

    switch (d) {//from w w w  .ja  v a2  s .  c  om
    case UP:
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.getSpin() * 90.0F, 0, 0, 1);
        break;
    case DOWN:
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.getSpin() * -90.0F, 0, 0, 1);
        break;
    case EAST:
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
        break;
    case WEST:
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
        break;
    case NORTH:
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        break;
    case SOUTH:
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
        break;

    default:
        break;
    }

    try {
        final ItemStack sis = ais.getItemStack();
        sis.stackSize = 1;

        final int br = 16 << 20 | 16 << 4;
        final int var11 = br % 65536;
        final int var12 = br / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        // RenderHelper.enableGUIStandardItemLighting();
        tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

        ClientHelper.proxy.doRenderItem(sis, this.getTile().getWorldObj());
    } catch (final Exception e) {
        AELog.error(e);
    } finally {
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    }

    GL11.glTranslatef(0.0f, 0.14f, -0.24f);
    GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f);

    final long stackSize = ais.getStackSize();
    final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize);

    final FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    final int width = fr.getStringWidth(renderedStackSize);
    GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
    fr.drawString(renderedStackSize, 0, 0, 0);

    // GL11.glPopAttrib();
}

From source file:appeng.parts.reporting.PartStorageMonitor.java

License:Open Source License

private void tesrRenderScreen(Tessellator tess, IAEItemStack ais) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    ForgeDirection d = this.side;
    GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77);

    if (d == ForgeDirection.UP) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.spin * 90.0F, 0, 0, 1);
    }/*from ww w.  ja va2 s  .  c o m*/

    if (d == ForgeDirection.DOWN) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(this.spin * -90.0F, 0, 0, 1);
    }

    if (d == ForgeDirection.EAST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (d == ForgeDirection.WEST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (d == ForgeDirection.NORTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
    }

    if (d == ForgeDirection.SOUTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    }

    GL11.glPushMatrix();
    try {
        ItemStack sis = ais.getItemStack();
        sis.stackSize = 1;

        int br = 16 << 20 | 16 << 4;
        int var11 = br % 65536;
        int var12 = br / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        // RenderHelper.enableGUIStandardItemLighting();
        tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

        ClientHelper.proxy.doRenderItem(sis, this.tile.getWorldObj());
    } catch (Exception e) {
        AELog.error(e);
    }

    GL11.glPopMatrix();

    GL11.glTranslatef(0.0f, 0.14f, -0.24f);
    GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f);

    final long stackSize = ais.getStackSize();
    final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize);

    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    int width = fr.getStringWidth(renderedStackSize);
    GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
    fr.drawString(renderedStackSize, 0, 0, 0);

    GL11.glPopAttrib();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderHolyKeyStone.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from  ww  w  .  j a  va  2s. co  m*/
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glRotatef(-5F, 1F, 0F, 0F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityHolyKeyStone(), 0.0D, 0.0D, 0.0D,
            0.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderHolyStone.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//from ww  w .j  a  va2 s  . co  m
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    float s = 1.4F;
    GL11.glScalef(s, s, s);
    GL11.glRotatef(-5F, 1F, 0F, 0F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityHolyStone(), 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderMomijiShield.java

License:Open Source License

private void render(Entity entity) {
    float limbSwing = 0F;
    float limbSwingAmount = 0F;
    float age = 0F;

    if (entity instanceof EntityLivingBase) {
        EntityLivingBase livingBase = (EntityLivingBase) entity;
        limbSwing = livingBase.limbSwing;
        limbSwingAmount = livingBase.limbSwingAmount;
        age = livingBase.getAge();//  w w  w.j  ava2 s .com
    }

    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
    GL11.glRotatef(60F, 0F, 0F, 1F);
    GL11.glTranslatef(0.5F, -0.5F, -0.2F);
    MODEL.render(entity, limbSwing, limbSwingAmount, age, entity.getRotationYawHead(), entity.rotationPitch,
            0.0625F);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderOnbashira.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//from  w  ww  .  jav a2s. com
    GL11.glTranslatef(0F, -0.7F, -0.5F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    float s = 0.5F;
    GL11.glScalef(s, s, s);
    GL11.glRotatef(0F, 0F, 0F, 0F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityOnbashira(), 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.RenderHolyKeyStone.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) {
    GL11.glPushMatrix();//from  w  w  w . j  ava2s . c  o  m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.4F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0f, 1f);
    bindTexture(TEXTURE);
    MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.RenderHolyStone.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) {
    GL11.glPushMatrix();//from w  w w.  ja va 2 s.  co  m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0f, 1f);
    bindTexture(TEXTURE);
    GL11.glPushMatrix();
    MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:arekkuusu.grimoireOfAlice.client.render.RenderOnbashira.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) {
    GL11.glPushMatrix();/*from   w  w  w. j  a  v a 2 s. c om*/
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glRotatef(180, 0F, 0f, 1f);
    bindTexture(TEXTURE);
    MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:aroma1997.betterchests.client.BChestRenderer.java

License:Open Source License

public void renderTileEntityChestAt(TileEntityBChest par1TileEntityChest, double par2, double par4, double par6,
        float par8) {
    int i;//from   www . j  av  a  2s  .c  o  m

    if (!par1TileEntityChest.hasWorldObj()) {
        i = 0;
    } else {
        Block block = par1TileEntityChest.getBlockType();
        i = par1TileEntityChest.getBlockMetadata();

        if (block instanceof BlockChest && i == 0) {
            i = par1TileEntityChest.getBlockMetadata();
        }
    }
    ModelChest modelchest = chestModel;
    bindTexture(model);

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    short short1 = 0;

    if (i == 2) {
        short1 = 180;
    }

    if (i == 3) {
        short1 = 0;
    }

    if (i == 4) {
        short1 = 90;
    }

    if (i == 5) {
        short1 = -90;
    }

    GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    float f1 = par1TileEntityChest.prevLidAngle
            + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8;

    f1 = 1.0F - f1;
    f1 = 1.0F - f1 * f1 * f1;
    modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
    modelchest.renderAll();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}