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:cn.lambdacraft.mob.client.renderer.RenderTurret.java

License:Open Source License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float f1) {
    EntitySentry turret = (EntitySentry) entity;
    GL11.glPushMatrix();/*from   w  w w  .j a v  a2 s  .c  o m*/
    GL11.glDisable(GL11.GL_CULL_FACE);
    RenderUtils.loadTexture(ClientProps.TURRET_PATH);
    super.doRender(entity, par2, par4, par6, par8, f1);
    GL11.glTranslatef((float) par2, (float) par4 + turret.height - turret.deathTime * 0.06F, (float) par6);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    if (turret.hurtResistantTime > 15)
        GL11.glColor3f(1.0F, 0.3F, 0.3F);
    GL11.glRotatef(turret.deathTime * 3, 1.0F, 0.2F, -1.0F);
    GL11.glRotatef(180.0F - turret.rotationYawHead, 0.0F, 1.0F, 0.0F);
    model.renderTop(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

From source file:cn.lambdalib.particle.RenderParticle.java

License:MIT License

@Override
public void doRender(Entity ent, double x, double y, double z, float a, float b) {
    if (RenderUtils.isInShadowPass())
        return;/*from   w w w  .  j av  a  2s  .c  o  m*/

    Particle ish = (Particle) ent;
    if (!ish.updated)
        return;

    ish.updateSprite(sprite);

    GL11.glAlphaFunc(GL11.GL_GREATER, 0.05f);
    GL11.glPushMatrix();

    if (ish.needViewOptimize()) {
        GL11.glTranslated(0, -0.2, 0);
    }

    GL11.glTranslated(x, y, z);
    if (ish.customRotation) {
        GL11.glRotatef(ish.rotationYaw, 0, 1, 0);
        GL11.glRotatef(ish.rotationPitch, 0, 0, 1);
    } else {
        GL11.glRotatef(180F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    }

    sprite.draw();

    GL11.glPopMatrix();
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
}

From source file:cn.lambdalib.template.client.render.entity.RenderCrossedProjectile.java

License:MIT License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) {
    Motion3D motion = new Motion3D(entity);
    Tessellator t = Tessellator.instance;

    GL11.glPushMatrix();// w ww  .j  a  v  a 2 s  . c  o  m
    {
        Vec3 v1 = newV3(0, HEIGHT, 0), v2 = newV3(0, -HEIGHT, 0), v3 = newV3(LENGTH, -HEIGHT, 0),
                v4 = newV3(LENGTH, HEIGHT, 0), v5 = newV3(0, 0, -HEIGHT), v6 = newV3(0, 0, HEIGHT),
                v7 = newV3(LENGTH, 0, HEIGHT), v8 = newV3(LENGTH, 0, -HEIGHT);

        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        if (renderTexture) {
            bindTexture(TEXTURE_PATH);
        } else {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glColor3f(colorR, colorG, colorB);
        }
        if (ignoreLight) {
            GL11.glDisable(GL11.GL_LIGHTING);
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
        }

        GL11.glTranslatef((float) par2, (float) par4, (float) par6);

        GL11.glRotatef(90 + entity.rotationYaw, 0.0F, -1.0F, 0.0F); // ?
        GL11.glRotatef(-entity.rotationPitch, 0.0F, 0.0F, 1.0F); // 

        if (this.playerViewOptm) {
            boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;
            if (firstPerson) {
                GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ);
            } else {
                GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ);
            }
        }

        t.startDrawingQuads();
        if (ignoreLight)
            t.setBrightness(15728880);

        RenderUtils.addVertex(v1, 0, 0);
        RenderUtils.addVertex(v2, 0, 1);
        RenderUtils.addVertex(v3, 1, 1);
        RenderUtils.addVertex(v4, 1, 0);

        RenderUtils.addVertex(v5, 0, 0);
        RenderUtils.addVertex(v6, 0, 1);
        RenderUtils.addVertex(v7, 1, 1);
        RenderUtils.addVertex(v8, 1, 0);

        t.draw();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glPopMatrix();
}

From source file:cn.lambdalib.template.client.render.entity.RenderIcon.java

License:MIT License

private void func_77026_a(Entity e, Tessellator tessllator) {
    float f4 = 1.0F;
    float f5 = 0.5F;
    float f6 = 0.25F;
    GL11.glRotatef(180F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    if (!hasLight)
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    firstTranslate(e);/*from w w  w . j  av  a2  s  .  com*/
    color.bind();
    tessllator.startDrawingQuads();
    if (!hasLight)
        tessllator.setBrightness(15728880);

    if (e instanceof IAssociatePlayer) {
        ViewOptimize.fix((IAssociatePlayer) e);
    }
    tessllator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, 0, 1);
    tessllator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, 1, 1);
    tessllator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, 1, 0);
    tessllator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, 0, 0);

    tessllator.draw();
}

From source file:cn.lambdalib.template.client.render.item.RenderModelItem.java

License:MIT License

public void renderInventory() {

    GL11.glDisable(GL11.GL_CULL_FACE);//ww  w  .  j  av  a2  s .  c o  m
    GL11.glPushMatrix();
    {

        RenderUtils.loadTexture(texturePath);

        GL11.glTranslated(8.0F + invOffset.x, 8.0F + invOffset.y, 0.0F);
        GL11.glScaled(16F * invScale, 16F * invScale, 16F * invScale);
        float rotation = 145F;
        if (inventorySpin)
            rotation = GameTimer.getAbsTime() / 100F;
        GL11.glRotatef(rotation, 0, 1, 0);
        this.doRotation(invRotation);
        GL11.glScalef(-1F, -1F, 1F);

        renderAtStdPosition();

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

From source file:cn.lambdalib.template.client.render.item.RenderModelItem.java

License:MIT License

public void renderEquipped(ItemStack item, RenderBlocks render, EntityLivingBase entity, ItemRenderType type) {

    if (item.stackTagCompound == null)
        item.stackTagCompound = new NBTTagCompound();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();// w w  w. jav a 2 s.c om
    {
        RenderUtils.loadTexture(texturePath);
        float sc2 = 0.0625F;
        GL11.glRotatef(40F, 0, 0, 1);
        if (type == ItemRenderType.EQUIPPED)
            this.doTransformation(thirdPersonOffset);
        this.doTransformation(equipOffset);
        this.doRotation(equipRotation);
        GL11.glRotatef(90, 0, -1, 0);
        GL11.glScaled(equipScale, equipScale, equipScale);
        if (type == ItemRenderType.EQUIPPED)
            GL11.glScaled(thirdPersonScale, thirdPersonScale, thirdPersonScale);
        renderAtStdPosition(getModelAttribute(item, entity));
    }
    GL11.glPopMatrix();

}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void renderOverlayEquip(ResourceLocation src) {
    //Setup//from  w w  w . j  av a2 s . co  m
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDisable(GL11.GL_LIGHTING);
    loadTexture(src);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    float f7 = 0.76F;
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    //Push texture mat
    GL11.glPushMatrix();
    float f8 = 0.125F;
    GL11.glScalef(f8, f8, f8);
    float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
    GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();

    //Second pass
    GL11.glPushMatrix();
    GL11.glScalef(f8, f8, f8);
    f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop
    GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation!
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();
    //Pop texture mat
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void renderOverlayInv(ResourceLocation src) {
    GL11.glDepthFunc(GL11.GL_EQUAL);/*from   ww  w.j av  a  2s . c o m*/
    GL11.glDisable(GL11.GL_LIGHTING);
    loadTexture(src);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    float f7 = 0.76F;
    //GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();
    float f8 = 0.125F;
    GL11.glScalef(f8, f8, f8);
    float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
    GL11.glTranslatef(f9, 0.0F, 0.0F);
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    t.startDrawingQuads();
    t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
    t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0);
    t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0);
    t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0);
    t.draw();
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glScalef(f8, f8, f8);
    f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F;
    GL11.glTranslatef(-f9, 0.0F, 0.0F);
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
    t.startDrawingQuads();
    t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0);
    t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0);
    t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0);
    t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0);
    t.draw();
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}

From source file:cn.liutils.api.client.render.RenderIcon.java

License:Open Source License

private void func_77026_a(Tessellator tessllator) {
    float f4 = 1.0F;
    float f5 = 0.5F;
    float f6 = 0.25F;
    GL11.glRotatef(180F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(r, g, b, alpha);/*  www.  j  av  a 2  s .  c om*/
    if (!hasLight)
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    tessllator.startDrawingQuads();

    if (!hasLight)
        tessllator.setBrightness(15728880);
    tessllator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, 0, 1);
    tessllator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, 1, 1);
    tessllator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, 1, 0);
    tessllator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, 0, 0);

    tessllator.draw();
}

From source file:cn.liutils.core.client.render.RenderPlayerHook.java

License:Open Source License

private void traverse(EntityPlayerHook ent, Set<IPlayerRenderHook> hooks) {
    for (IPlayerRenderHook hook : hooks) {
        GL11.glPushMatrix();/*from   ww w.j  av  a  2  s . c o m*/
        GL11.glRotatef(ent.rotationYaw, 0.0F, -1.0F, 0.0F);
        GL11.glPushMatrix();
        {
            GL11.glTranslated(0, -1.67, 0);
            hook.renderBody(ent.player, ent.worldObj);
        }
        GL11.glPopMatrix();
        GL11.glTranslatef(0.0F, 0.5F, 0.0F);
        hook.renderHead(ent.player, ent.worldObj);
        GL11.glPopMatrix();
    }
}