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:chemistry.electrolysm.client.RenderTileBunsenBurner.java

License:Open Source License

private void rotateByMeta(int meta) {
    if (meta == 2) {
        //south// w ww .  j a  va2s.  c  o  m
        GL11.glRotatef(-90F, 0F, 1F, 0F);
    } else if (meta == 5) {
        //west
        GL11.glRotatef(180F, 0F, 1F, 0F);
    } else if (meta == 3) {
        //north
        GL11.glRotatef(90F, 0F, 1F, 0F);
    } else if (meta == 4) {
        //east
        GL11.glRotatef(0F, 0F, 1F, 0F);
    }
}

From source file:chemistry.electrolysm.client.RenderTileCleaner.java

License:Open Source License

private void rotateByMeta(int meta) {
    if (meta == 2) {
        //south/*  ww  w.java2 s  .co  m*/
        GL11.glRotatef(-90F, 0F, 1F, 0F);
    } else if (meta == 5) {
        //west
        //GL11.glRotatef(90F, 0F, 1F, 0F);
    } else if (meta == 3) {
        //north
        GL11.glRotatef(90F, 0F, 1F, 0F);
    } else if (meta == 4) {
        //east
        GL11.glRotatef(180F, 0F, 1F, 0F);
    }
}

From source file:chessMod.client.ChessModDrawBlockHighlightHandler.java

License:LGPL

public static void highlightTile(EntityPlayer player, double x, double y, double z, float partialTicks) {

    x += 0.5D;//ww  w.j a  v  a2 s .  com
    y += 0.5D;
    z += 0.5D;
    double iPX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
    double iPY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
    double iPZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;

    float xScale = 1.0F;
    float yScale = 1;
    float zScale = 1.0F;
    float xShift = 0.0F;
    float yShift = 0.01F;
    float zShift = 0.0F;

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 4; i < 5; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        drawQuad(-0.5F, -0.5F, 1F, 1F, 0F);
        GL11.glPopMatrix();
    }

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(true);
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

private void drawPlayer() {
    EntityPlayer player = dev.user;/*from  ww  w.j  ava2s.c o  m*/
    RenderUtils.loadTexture(RenderUtils.STEVE_TEXTURE);
    float x = 100, y = 100, scale = 2.1F;
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef(183, 58, 100F);
        GL11.glScalef((-scale), scale, scale);
        GL11.glRotated(-25, 1, 0, 0);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(Minecraft.getSystemTime() / 100F, 0F, 1F, 0F); //Rotate around Y
        model.render(player, 0, 0, 0, 0, 0, 1F);
    }
    GL11.glPopMatrix();
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
}

From source file:cn.academy.core.client.render.RenderEntityBlock.java

License:GNU General Public License

@Override
public void doRender(Entity e, double x, double y, double z, float pt, float b) {
    EntityBlock entity = (EntityBlock) e;

    if (entity.block != null) {
        GL11.glPushMatrix();/*from  w ww  . j  av a2s  . c om*/
        {
            Tessellator tes = Tessellator.instance;
            tes.setColorOpaque_F(1.0F, 1.0F, 1.0F);

            renderBlocks.blockAccess = e.worldObj;
            {
                if (Minecraft.isAmbientOcclusionEnabled()) {
                    GL11.glShadeModel(GL11.GL_SMOOTH);
                } else {
                    GL11.glShadeModel(GL11.GL_FLAT);
                }
                RenderHelper.disableStandardItemLighting();

                RenderUtils.loadTexture(TextureMap.locationBlocksTexture);

                //x += b * entity.motionX;
                //y += b * entity.motionY;
                //z += b * entity.motionZ;

                int ix = (int) entity.posX, iy = (int) entity.posY, iz = (int) entity.posZ;

                GL11.glTranslated(x, y, z);

                GL11.glRotatef(MathUtils.lerpf(entity.lastYaw, entity.yaw, pt), 0, 1, 0);
                GL11.glRotatef(MathUtils.lerpf(entity.lastPitch, entity.pitch, pt), 1, 0, 0);

                GL11.glTranslated(-ix - 0.5, -iy - 0.5, -iz - 0.5);

                tes.startDrawingQuads();
                renderBlocks.renderBlockAllFaces(entity.block, ix, iy, iz);
                tes.setTranslation(0, 0, 0);
                tes.draw();

                RenderHelper.enableStandardItemLighting();
            }
        }
        GL11.glPopMatrix();
    }

    if (entity.tileEntity != null) {
        entity.tileEntity.blockType = entity.block;
        TileEntitySpecialRenderer tesr = TileEntityRendererDispatcher.instance
                .getSpecialRenderer(entity.tileEntity);
        if (tesr != null) {
            try {
                tesr.renderTileEntityAt(entity.tileEntity, x - 0.5, y, z - 0.5, pt);
            } catch (Exception ex) {
                AcademyCraft.log.error("Error handling EntityBlock TE rendering: " + tesr.getClass());
                ex.printStackTrace();
            }
        }
    }
}

From source file:cn.academy.core.client.render.SkillRenderManager.java

License:Open Source License

public static void renderThirdPerson(EntityLivingBase ent, ItemStack stack, ItemRenderType type) {
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || !(ent instanceof EntityPlayer))
        return;//  ww w.java 2s. co  m
    EntityPlayer player = (EntityPlayer) ent;
    Item item = stack.getItem();
    Block block = Block.getBlockFromItem(stack.getItem());
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {

        GL11.glColor4d(1, 0.6, 0.6, 0.55);

        if (stack.getItemSpriteNumber() == 0 && item instanceof ItemBlock) { //block render routine
            GL11.glTranslated(0, 0, 1.5);
            GL11.glScalef(2F, 2F, 2F);
            GL11.glRotated(45, 1, 0, 1);
            GL11.glRotated(45, 0, 1, 0);
            GL11.glRotated(180, 1, 0, 0);
        } else if (item.isFull3D()) {
            GL11.glTranslated(0.1, 0.8, -.4);
            GL11.glScalef(.8F, .8F, .8F);
            GL11.glRotated(45, 0, 0, -1);
        } else {
            GL11.glTranslated(-.3, 1.2, -.6);
            GL11.glRotatef(90, 1, 0, 0);
            GL11.glScalef(1.5F, 1.5F, 1.5F);
        }

        traverseHandRender(player, HandRenderType.EQUIPPED);

    }
    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.render.SkillRenderManager.java

License:Open Source License

public static void renderFirstPerson() {
    //System.out.println("rfp");
    GL11.glDepthFunc(GL11.GL_LEQUAL);//w w w.j  av a  2  s .co m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(0.28, -0.55, -.9);
        GL11.glColor4d(1, 0.6, 0.6, 0.55);
        GL11.glScalef(0.66F, 0.66F, 0.66F);
        GL11.glRotatef(20, 1, 0, 0);

        //RenderUtils.loadTexture(ACClientProps.TEX_ARC_SHELL[0]);
        //RenderUtils.drawCube(1, 1, 1, false);
        traverseHandRender(Minecraft.getMinecraft().thePlayer, HandRenderType.FIRSTPERSON);
        //rpe.renderHandEffect(Minecraft.getMinecraft().thePlayer, null, HandRenderType.FIRSTPERSON);

    }
    GL11.glPopMatrix();
}

From source file:cn.academy.vanilla.meltdowner.client.render.RenderMdShield.java

License:GNU General Public License

@Override
public void doRender(Entity _entity, double x, double y, double z, float a, float b) {
    if (RenderUtils.isInShadowPass()) {
        return;//from  www.j a  v  a  2s  . co m
    }

    long time = GameTimer.getTime();
    EntityMdShield entity = (EntityMdShield) _entity;

    // Calculate rotation
    long dt;
    if (entity.lastRender == 0)
        dt = 0;
    else
        dt = time - entity.lastRender;

    float rotationSpeed = MathUtils.lerpf(0.8f, 2f, Math.min(entity.ticksExisted / 30.0f, 1f));
    entity.rotation += rotationSpeed * dt;
    if (entity.rotation >= 360f)
        entity.rotation -= 360f;

    ShaderSimple.instance().useProgram();
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.05f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);
    GL11.glRotatef(-entity.rotationYaw, 0, 1, 0);
    GL11.glRotatef(entity.rotationPitch, 1, 0, 0);
    GL11.glRotatef(entity.rotation, 0, 0, 1);

    float size = EntityMdShield.SIZE * MathUtils.lerpf(0.2f, 1f, Math.min(entity.ticksExisted / 15.0f, 1f));
    float alpha = Math.min(entity.ticksExisted / 6.0f, 1.0f);

    GL11.glScalef(size, size, 1);

    RenderUtils.loadTexture(texture);
    mesh.draw(ShaderSimple.instance());

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL20.glUseProgram(0);

    entity.lastRender = time;
}

From source file:cn.lambdacraft.mob.client.model.ModelHeadcrab.java

License:Open Source License

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    super.render(entity, f, f1, f2, f3, f4, f5);
    if (!entity.onGround) {
        EntityHeadcrab crab = (EntityHeadcrab) entity;
        GL11.glTranslatef(0.0F, 1.5F, 0.0F);
        if (crab.attacher == null) {
            float angle = -MathHelper.sin((crab.ticksExisted - crab.lastJumpTick) * 0.1F) * 40F;
            GL11.glRotatef(angle, 1.0F, 0.0F, 0.0F);
        } else {/*from www  . ja v  a 2s  .co m*/
            GL11.glRotatef(35F, 1.0F, 0.0F, 0.0F);
        }
        GL11.glTranslatef(0.0F, -1.5F, 0.0F);
    }
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    leg41.render(f5);
    leg31.render(f5);
    body.render(f5);
    leg1.render(f5);
    leg2.render(f5);
    leg3.render(f5);
    leg4.render(f5);
}

From source file:cn.lambdacraft.mob.client.renderer.RenderBarnacle.java

License:Open Source License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) {
    EntityBarnacle barnacle = (EntityBarnacle) entity;
    Tessellator t = Tessellator.instance;
    GL11.glPushMatrix();/*from  www .  j a  v  a  2s  .co m*/
    Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.BARNACLE_PATH);
    GL11.glTranslatef((float) par2, (float) par4 + 2 * entity.height, (float) par6);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    GL11.glTranslatef(0.0F, 1.5F, 0.0F);
    if (barnacle.getHealth() <= 0)
        GL11.glRotatef(barnacle.deathTime * 6.5F, 1.0F, 0.0F, -1.0F);
    GL11.glTranslatef(0.0F, -1.5F, 0.0F);
    if (barnacle.hurtResistantTime > 10)
        GL11.glColor3f(1.0F, 0.5F, 0.5F);

    this.model.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    if (barnacle.getHealth() > 0) {
        //Barnacle Tentacle Render
        double length = barnacle.tentacleLength;
        double h1 = 0.5, h2 = length + 1.0;
        Vec3 v1 = RenderUtils.newV3(-WIDTH, h1, -WIDTH), v2 = RenderUtils.newV3(-WIDTH, h1, WIDTH),
                v3 = RenderUtils.newV3(WIDTH, h1, WIDTH), v4 = RenderUtils.newV3(WIDTH, h1, -WIDTH);
        Vec3 v5 = RenderUtils.newV3(-WIDTH, h1, -WIDTH), v6 = RenderUtils.newV3(-WIDTH, h2, WIDTH),
                v7 = RenderUtils.newV3(WIDTH, h2, WIDTH), v8 = RenderUtils.newV3(WIDTH, h2, -WIDTH);
        Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.BARNACLE_TENTACLE_PATH);

        t.startDrawingQuads();
        RenderUtils.addVertex(v1, 0.0, 0.0);
        RenderUtils.addVertex(v5, 0.0, length);
        RenderUtils.addVertex(v6, 1.0, length);
        RenderUtils.addVertex(v2, 1.0, 0.0);

        RenderUtils.addVertex(v2, 0.0, 0.0);
        RenderUtils.addVertex(v6, 0.0, length);
        RenderUtils.addVertex(v7, 1.0, length);
        RenderUtils.addVertex(v3, 1.0, 0.0);

        RenderUtils.addVertex(v3, 0.0, 0.0);
        RenderUtils.addVertex(v7, 0.0, length);
        RenderUtils.addVertex(v8, 1.0, length);
        RenderUtils.addVertex(v4, 1.0, 0.0);

        RenderUtils.addVertex(v4, 0.0, 0.0);
        RenderUtils.addVertex(v8, 0.0, length);
        RenderUtils.addVertex(v5, 1.0, length);
        RenderUtils.addVertex(v1, 1.0, 0.0);

        RenderUtils.addVertex(v8, 0.0, 0.0);
        RenderUtils.addVertex(v7, 0.0, 0.1);
        RenderUtils.addVertex(v6, 0.1, 0.1);
        RenderUtils.addVertex(v5, 0.1, 0.0);
        t.draw();
    }
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}