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:zeldaswordskills.client.render.item.RenderItemCustomBow.java

License:Open Source License

private void renderEquippedBow(ItemStack stack, EntityLivingBase entity, boolean firstPerson) {
    GL11.glPushMatrix();/*from w  w w . j a  v  a 2  s .  c om*/
    Tessellator tessellator = Tessellator.instance;

    if (entity instanceof EntityPlayer) {
        if (!firstPerson) {
            GL11.glRotated(15.0D, 0.02D, 0.01D, 0.0D);
            GL11.glTranslated(0.1D, -0.3D, 0.2D);
        }
        EntityPlayer player = (EntityPlayer) entity;
        IIcon icon = stack.getItem().getIcon(stack, 0, player, player.getItemInUse(),
                player.getItemInUseCount());
        ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
                icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
        int useDuration = player.getItemInUseDuration();
        if (useDuration > 0) {
            int drawAmount = (useDuration > 17 ? 2 : (useDuration > 13 ? 1 : 0));
            ItemStack arrowStack = (stack.getItem() instanceof ItemHeroBow
                    ? ((ItemHeroBow) stack.getItem()).getArrow(player)
                    : vanillaArrow);
            if (ZSSMain.isBG2Enabled) {
                ItemStack quiverArrow = BattlegearEvents.getQuiverArrow(stack, player);
                if (quiverArrow != null) {
                    arrowStack = quiverArrow;
                }
            }

            if (arrowStack != null) {
                icon = arrowStack.getIconIndex();
                GL11.glPushMatrix();
                // Thanks to BG2 team for the translation calculations:
                GL11.glTranslatef(-(-3F + drawAmount) / 16F, -(-3F + drawAmount) / 16F,
                        firstPerson ? -0.5F / 16F : 0.5F / 16F);
                ItemRenderer.renderItemIn2D(tessellator, icon.getMinU(), icon.getMinV(), icon.getMaxU(),
                        icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
                GL11.glPopMatrix();
            }
        }
    } else {
        IIcon icon = stack.getItem().getIcon(stack, 0);
        ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
                icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    }

    GL11.glPopMatrix();
}