Example usage for org.lwjgl.opengl GL11 glPushMatrix

List of usage examples for org.lwjgl.opengl GL11 glPushMatrix

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glPushMatrix.

Prototype

public static native void glPushMatrix();

Source Link

Document

Pushes the current matrix stack down by one, duplicating the current matrix in both the top of the stack and the entry below it.

Usage

From source file:com.blogspot.jabelarminecraft.magicbeans.renderers.RenderMysteriousStranger.java

License:Open Source License

@Override
public void passSpecialRender(EntityLivingBase parEntity, double parX, double parY, double parZ) {
    super.passSpecialRender(parEntity, parX, parY, parZ);
    if (parEntity.ticksExisted < 20 * 2) {
        GL11.glPushMatrix();
        GL11.glTranslated(parX, parY + parEntity.height / 2, parZ);
        GL11.glScalef(3.0F, 3.0F, 3.0F);
        GL11.glEnable(GL11.GL_BLEND);/*from ww w. jav a  2s  .c  o m*/
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, (40.0F - parEntity.ticksExisted) / 40.0F);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glCallList(ClientProxy.sphereIdOutside);
        GL11.glCallList(ClientProxy.sphereIdInside);
        GL11.glPopMatrix();
    }
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelBigCat.java

License:Open Source License

public void renderBigCat(EntityBigCat entity, float f, float f1, float f2, float f3, float f4, float f5) {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glTranslatef(0F, -0.2F, 0F); // need to figure out how to calculate this from scaleFactor (need to manually tweak currently)
    GL11.glScalef(entity.getScaleFactor(), entity.getScaleFactor(), entity.getScaleFactor());

    if (!isChild) {
        head.renderWithRotation(f5);//from   w w  w  .  j a  va2s. c  o m
        body.render(f5);
        leg1.render(f5);
        leg2.render(f5);
        leg3.render(f5);
        leg4.render(f5);
        tail.renderWithRotation(f5);
    } else {
        float f6 = 2.0F;
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 5.0F * f5, 2.0F * f5);
        head.renderWithRotation(f5);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
        GL11.glTranslatef(-0.05F, 24.0F * f5, 0.0F);
        body.render(f5);
        leg1.render(f5);
        leg2.render(f5);
        leg3.render(f5);
        leg4.render(f5);
        tail.renderWithRotation(f5);
        GL11.glPopMatrix();
    }

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelBirdOfPrey.java

License:Open Source License

public void renderBirdOfPrey(EntityBirdOfPrey parEntity, float parRenderFloat) {
    setRotationAngles(parEntity);/*from   w  w  w  . j a v a  2 s .  c o  m*/

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

    // should only need to render body because all rest are children
    if (parEntity.getState() == AIStates.STATE_PERCHED
            || parEntity.getState() == AIStates.STATE_PERCHED_TAMED) {
        bodyWingless.render(parRenderFloat);
    } else {
        body.render(parRenderFloat);
    }

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelElephant.java

License:Open Source License

public void renderElephant(EntityElephant parEntity, float parTime, float parSwingSuppress, float par4,
        float parHeadAngleY, float parHeadAngleX, float par7) {
    setRotationAngles(parTime, parSwingSuppress, par4, parHeadAngleY, parHeadAngleX, par7, parEntity);

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glTranslatef(0F, -1.5F, 0F);/*from   ww w  .  j a  v a2  s .  co m*/
    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

    if (this.isChild) {
        float f6 = 2.0F;
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, this.field_78145_g * par7, this.field_78151_h * par7);
        childHead.render(par7);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
        GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
        body.render(par7);
        // scale legs slightly to reduce render flicker on overlapping areas
        GL11.glPushMatrix();
        GL11.glScalef(0.99F, 1.00F, 0.99F);
        legRearRight.render(par7);
        legRearLeft.render(par7);
        legFrontRight.render(par7);
        legFrontLeft.render(par7);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    } else {
        head.render(par7);
        body.render(par7);
        // scale legs slightly to reduce render flicker on overlapping areas
        GL11.glPushMatrix();
        GL11.glScalef(0.99F, 1.00F, 0.99F);
        legRearRight.render(par7);
        legRearLeft.render(par7);
        legFrontRight.render(par7);
        legFrontLeft.render(par7);
        GL11.glPopMatrix();
    }

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelRaptor.java

License:Open Source License

@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {

    // Set Rotation
    this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);

    // Initiate Matrix
    GL11.glPushMatrix();

    // Set Scale/*from   w w w  . j a  v a 2 s  . c o  m*/
    GL11.glScalef(1.0F / shrink_factor, 1.0F / shrink_factor, 1.0F / shrink_factor);
    GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);

    this.head.render(par7);
    this.headb.render(par7);
    this.headuppera.render(par7);
    this.headupperb.render(par7);
    this.tongue.render(par7);

    this.tooth1a.render(par7);
    this.tooth2a.render(par7);
    this.tooth1b.render(par7);
    this.tooth2b.render(par7);
    this.tooth1c.render(par7);
    this.tooth2c.render(par7);
    this.tooth1d.render(par7);
    this.tooth2d.render(par7);
    this.tooth1e.render(par7);
    this.tooth2e.render(par7);
    this.tooth1f.render(par7);
    this.tooth2f.render(par7);
    this.tooth1g.render(par7);
    this.tooth2g.render(par7);
    this.tooth1h.render(par7);
    this.tooth2h.render(par7);
    this.tooth1i.render(par7);
    this.tooth2i.render(par7);
    this.tooth1j.render(par7);
    this.tooth2j.render(par7);
    this.tooth1k.render(par7);
    this.tooth2k.render(par7);
    this.tooth1l.render(par7);
    this.tooth2l.render(par7);
    this.tooth1m.render(par7);
    this.tooth2m.render(par7);
    this.tooth1n.render(par7);
    this.tooth2n.render(par7);
    this.tooth1o.render(par7);
    this.tooth2o.render(par7);

    // Set Scale
    GL11.glScalef(0.995F, 1.0F, 1.0F);

    this.headlowera.render(par7);
    this.headlowerb.render(par7);

    GL11.glScalef(1 / 0.995F, 1.0F, 1.0F);

    this.body.render(par7);
    //this.neck.render(par7);
    this.taila.render(par7);
    this.tailb.render(par7);
    this.tailc.render(par7);
    this.taild.render(par7);
    this.taile.render(par7);

    this.leftarm.render(par7);
    this.lefthanda.render(par7);
    this.lefthandb.render(par7);

    this.rightarm.render(par7);
    this.righthanda.render(par7);
    this.righthandb.render(par7);

    this.leftleg.render(par7);
    //this.leftlegb.render(par7);
    this.leftlegc.render(par7);
    this.leftfoot.render(par7);
    this.leftfoottoe1a.render(par7);
    this.leftfoottoe2a.render(par7);
    this.leftfoottoe1b.render(par7);
    this.leftfoottoe2b.render(par7);

    this.rightleg.render(par7);
    //this.rightlegb.render(par7);
    this.rightlegc.render(par7);
    this.rightfoot.render(par7);
    this.rightfoottoe1a.render(par7);
    this.rightfoottoe2a.render(par7);
    this.rightfoottoe1b.render(par7);
    this.rightfoottoe2b.render(par7);

    // Handle Smaller Parts

    // Set Scale
    GL11.glScalef(0.995F, 1.0F, 1.0F);

    this.neck.render(par7);
    this.leftlegb.render(par7);
    this.rightlegb.render(par7);
    this.headlowerb.render(par7);

    // Finish Matrix
    GL11.glPopMatrix();

}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelRendererWildAnimals.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void render(float par1) {
    if (!this.isHidden) {
        if (this.showModel) {
            if (!this.compiled) {
                this.compileDisplayList(par1);
            }/* w  w w  .  j  a  va2 s.  co m*/

            GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ);
            int i;

            if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) {
                if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) {
                    GL11.glCallList(this.displayList);

                    if (this.childModels != null) {
                        for (i = 0; i < this.childModels.size(); ++i) {
                            ((ModelRendererWildAnimals) this.childModels.get(i)).render(par1);
                        }
                    }
                } else {
                    GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1,
                            this.rotationPointZ * par1);
                    GL11.glCallList(this.displayList);

                    if (this.childModels != null) {
                        for (i = 0; i < this.childModels.size(); ++i) {
                            ((ModelRendererWildAnimals) this.childModels.get(i)).render(par1);
                        }
                    }

                    GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1,
                            -this.rotationPointZ * par1);
                }
            } else {
                GL11.glPushMatrix();
                GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1,
                        this.rotationPointZ * par1);

                if (this.rotateAngleZ != 0.0F) {
                    GL11.glRotatef(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
                }

                if (this.rotateAngleY != 0.0F) {
                    GL11.glRotatef(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
                }

                if (this.rotateAngleX != 0.0F) {
                    GL11.glRotatef(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
                }

                GL11.glCallList(this.displayList);

                if (this.childModels != null) {
                    for (i = 0; i < this.childModels.size(); ++i) {
                        ((ModelRendererWildAnimals) this.childModels.get(i)).render(par1);
                    }
                }

                GL11.glPopMatrix();
            }

            GL11.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ);
        }
    }
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelRendererWildAnimals.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void renderWithRotation(float par1) {
    if (!this.isHidden) {
        if (this.showModel) {
            if (!this.compiled) {
                this.compileDisplayList(par1);
            }/* w w w.ja  v a2s . c  om*/

            GL11.glPushMatrix();
            GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1,
                    this.rotationPointZ * par1);

            if (this.rotateAngleY != 0.0F) {
                GL11.glRotatef(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
            }

            if (this.rotateAngleX != 0.0F) {
                GL11.glRotatef(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
            }

            if (this.rotateAngleZ != 0.0F) {
                GL11.glRotatef(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
            }

            GL11.glCallList(this.displayList);
            GL11.glPopMatrix();
        }
    }
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelSeaHorse.java

License:Open Source License

public void renderSerpent(EntitySerpent parEntity, float parTime, float parSwingSuppress, float par4,
        float parHeadAngleY, float parHeadAngleX, float par7) {
    setRotationAngles(parTime, parSwingSuppress, par4, parHeadAngleY, parHeadAngleX, par7, parEntity);

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

    if (this.isChild) {
        float f6 = 2.0F;
        GL11.glPushMatrix();//  w w w. j a  va 2  s  .  co m
        GL11.glTranslatef(0.0F, this.field_78145_g * par7, this.field_78151_h * par7);
        head.render(par7);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
        GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
        body1.render(par7); // all rest of body are children of body1
        GL11.glPopMatrix();
    } else {
        head.render(par7);
        body1.render(par7); // all rest of body are children of body1
    }

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelSerpent.java

License:Open Source License

public void renderSerpent(EntitySerpent parEntity, float parTime, float parSwingAmount, float par4,
        float parHeadAngleY, float parHeadAngleX, float par7) {
    setRotationAngles(parTime, parSwingAmount, par4, parHeadAngleY, parHeadAngleX, par7, parEntity);

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

    if (this.isChild) {
        float childScaleFactor = 0.5F;
        GL11.glPushMatrix();/*from  w  w  w  . j av a2  s  . c o m*/
        GL11.glScalef(1.0F * childScaleFactor, 1.0F * childScaleFactor, 1.0F * childScaleFactor);
        GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
        head.render(par7);
        // flick tongue occasionally
        if (parEntity.ticksExisted % 60 == 0 && parSwingAmount <= 0.1F) {
            tongue.render(par7);
        }
        body1.render(par7); // all rest of body are children of body1
        GL11.glPopMatrix();
    } else {
        head.render(par7);
        // flick tongue occasionally

        if (parEntity.ticksExisted % 60 == 0 && parSwingAmount <= 0.1F) {
            tongue.render(par7);
        }
        body1.render(par7); // all rest of body are children of body1
    }

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.wildanimals.renderers.RenderThrowableSpawnEgg.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.
 *//*w w w .  j  av a 2s.c o m*/
public void doRender(EntityWildAnimalsEgg parEntityWildAnimalsEgg, double parPosX, double parPosY,
        double parPosZ, float p_76986_8_, float parTweenFactor) {
    bindEntityTexture(parEntityWildAnimalsEgg);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) parPosX, (float) parPosY, (float) parPosZ);
    GL11.glRotatef(parEntityWildAnimalsEgg.prevRotationYaw
            + (parEntityWildAnimalsEgg.rotationYaw - parEntityWildAnimalsEgg.prevRotationYaw) * parTweenFactor
            - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(parEntityWildAnimalsEgg.prevRotationPitch
            + (parEntityWildAnimalsEgg.rotationPitch - parEntityWildAnimalsEgg.prevRotationPitch)
                    * parTweenFactor,
            0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = 0.0F;
    float f5 = 5 / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = 5 / 32.0F;
    float f9 = 10 / 32.0F;
    float scaleFactor = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float f11 = -parTweenFactor;

    if (f11 > 0.0F) {
        float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
        GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
    }

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(scaleFactor, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);
    tessellator.draw();
    GL11.glNormal3f(-scaleFactor, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
    tessellator.draw();

    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, scaleFactor);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5);
        tessellator.draw();
    }

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