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:com.builtbroken.gascan.content.BucketMaterialCanClient.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from  w  w w  .jav  a 2 s.  co m*/
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

    if (type == ItemRenderType.EQUIPPED) {
        GL11.glRotatef(-40, 0, 1, 0);
        //GL11.glRotatef(13, 1, 0, 0);
        GL11.glTranslatef(1f, -1.1f, 0.1f);

        final float scale = 0.0625f / 4;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(-90, 0, 1, 0);
        //GL11.glRotatef(-13, 1, 0, 0);
        GL11.glTranslatef(1f, 0.6f, 0.5f);

        final float scale = 0.0625f / 5;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    } else if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0f, 0, 0);

        final float scale = 0.0625f / 4;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.grappling.content.entity.RenderHook.java

@Override
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    GL11.glPushMatrix();/* www .j a v  a 2 s . c o m*/
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glDisable(GL11.GL_LIGHTING);

    final float scale = 0.0625f / 3;
    GL11.glScalef(scale, scale, scale);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(getEntityTexture(entity));
    if (entity instanceof EntityHook) {
        final Hook hook = ((EntityHook) entity).hook;

        if (hook != null) {
            switch (hook.side) {
            //Bottom
            case 0:
                GL11.glRotatef(-90, 1, 0, 0);
                break;
            //Top
            case 1:
                GL11.glRotatef(90, 1, 0, 0);
                break;
            //North
            case 2:
                //Default rotation
                break;
            //South
            case 3:
                GL11.glRotatef(180, 0, 1, 0);
                break;
            case 4:
                GL11.glRotatef(90, 0, 1, 0);
                break;
            case 5:
                GL11.glRotatef(-90, 0, 1, 0);
                break;
            }
        }
    }
    MODEL.renderAll();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:com.builtbroken.grappling.content.item.ItemHookRenderer.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//  ww  w  .ja  v a  2s .c o m

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

    Entity entity = null;

    if (data != null && data.length >= 2 && data[1] instanceof Entity) {
        entity = (Entity) data[1];
    }

    if (type == ItemRenderType.EQUIPPED) {
        //TODO have rotation match aiming point
        GL11.glRotatef(-130, 0, 1, 0);
        //GL11.glRotatef(13, 1, 0, 0);
        GL11.glTranslatef(0.1f, 0.4f, -1.2f);

        final float scale = 0.0625f / 3;
        GL11.glScalef(scale, scale, scale);
        if (entity != null && entity == Minecraft.getMinecraft().thePlayer) {
            if (ClientHookHandler.hook != null) {
                MODEL.renderAllExcept("group5", "Component_20");
            } else {
                MODEL.renderAll();
            }
        } else {
            MODEL.renderAll();
        }
    } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(140, 0, 1, 0);
        GL11.glRotatef(-13, 1, 0, 0);
        GL11.glTranslatef(-0.2f, 0.6f, -0.5f);

        final float scale = 0.0625f / 3;
        GL11.glScalef(scale, scale, scale);
        if (ClientHookHandler.hook != null) {
            MODEL.renderAllExcept("group5", "Component_20");
        } else {
            MODEL.renderAll();
        }
    } else if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0f, 0, -0.9f);

        final float scale = 0.0625f / 3;
        GL11.glScalef(scale, scale, scale);
        MODEL.renderAll();
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.ams.TileAMSClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glTranslatef(0.5f, 0, 0.5f);/*from  w  w  w  . j ava  2 s .c  o  m*/

    GL11.glRotatef(90, 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.AMS_TEXTURE);
    Assets.AMS_BOTTOM_MODEL.renderAll();

    GL11.glTranslatef(0, 0.5f, 0);
    Assets.AMS_TOP_MODEL.renderAll();
}

From source file:com.builtbroken.icbm.content.ams.TileAMSClient.java

@SideOnly(Side.CLIENT)
public void renderDynamic(Pos pos, float deltaTime, int pass) {
    //Lerp rotation values so not to have snapping effects(looks bad)
    if (!currentAim.isWithin(aim, 1)) {
        currentAim.moveTowards(aim, ROTATION_SPEED, deltaTime).clampTo360();
    }/*from www .  ja  v a  2 s.c  o m*/
    lastRotationUpdate = System.nanoTime();
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f);

    GL11.glRotatef((float) ((currentAim.yaw() + 90f) % 360), 0, 1, 0);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.AMS_TEXTURE);
    Assets.AMS_BOTTOM_MODEL.renderAll();

    GL11.glTranslatef(0, 0.5f, 0);
    GL11.glRotatef((float) currentAim.pitch(), 0, 0, 1);
    Assets.AMS_TOP_MODEL.renderAll();

    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraftClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glTranslatef(0f, 0f, 0f);/*from w  w w .  j a va  2 s  .  c  o m*/
    GL11.glRotatef(-20f, 0, 1, 0);
    GL11.glScaled(.7f, .7f, .7f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2);
    Assets.CART1x3.renderAll();
}

From source file:com.builtbroken.icbm.content.crafting.station.small.TileSmallMissileWorkstationClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glTranslatef(-1f, 0f, 0.1f);/* www  .j  a va  2  s .c  o  m*/
    GL11.glRotatef(-20f, 0, 1, 0);
    GL11.glScaled(.7f, .7f, .7f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2);
    Assets.SMALL_MISSILE_STATION_MODEL2.renderAll();
    //TODO add work table
}

From source file:com.builtbroken.icbm.content.fof.TileFoFClient.java

@Override
public void renderDynamic(Pos pos, float frame, int pass) {
    //Render launcher
    GL11.glPushMatrix();//from   w  w w .j a v  a  2 s .c  o m
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 0.5f, pos.zf() + 0.5f);
    switch (getDirection()) {
    case EAST:
        break;
    case WEST:
        GL11.glRotatef(180f, 0, 1f, 0);
        break;
    case SOUTH:
        GL11.glRotatef(-90f, 0, 1f, 0);
        break;
    default:
        GL11.glRotatef(90f, 0, 1f, 0);
        break;
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE);
    Assets.FoF_STATION_MODEL.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.fof.TileFoFClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    if (type == IItemRenderer.ItemRenderType.INVENTORY) {
        GL11.glTranslatef(-0.5f, -0.6f, -0.5f);
        GL11.glScaled(.5f, .5f, .5f);//w  w w.j  av  a 2  s.  co  m
    } else if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(150f, 0, 1, 0);
    } else if (type == IItemRenderer.ItemRenderType.EQUIPPED) {
        GL11.glRotatef(150f, 0, 1, 0);
        GL11.glTranslatef(-0.5f, 0.3f, -0.5f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE);
    Assets.FoF_STATION_MODEL.renderAll();
}

From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java

public void doRenderFireBall(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_, float scale) {
    GL11.glPushMatrix();/*w w w . j  av a2 s.  c  o m*/
    this.renderManager.renderEngine.bindTexture(TextureMap.locationItemsTexture);

    GL11.glTranslatef((float) xx, (float) yy, (float) zz);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(scale / 1.0F, scale / 1.0F, scale / 1.0F);

    IIcon iicon = Items.fire_charge.getIconFromDamage(0);
    Tessellator tessellator = Tessellator.instance;

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

    float f7 = 1.0F;
    float f8 = 0.5F;
    float f9 = 0.25F;

    GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV((double) (0.0F - f8), (double) (0.0F - f9), 0.0D, (double) minU, (double) maxV);
    tessellator.addVertexWithUV((double) (f7 - f8), (double) (0.0F - f9), 0.0D, (double) maxU, (double) maxV);
    tessellator.addVertexWithUV((double) (f7 - f8), (double) (1.0F - f9), 0.0D, (double) maxU, (double) minV);
    tessellator.addVertexWithUV((double) (0.0F - f8), (double) (1.0F - f9), 0.0D, (double) minU, (double) minV);
    tessellator.draw();

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