Example usage for org.lwjgl.opengl GL11 glScalef

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

Introduction

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

Prototype

public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a general scaling matrix along the x-, y- and z- axes.

Usage

From source file:lyonlancer5.pfsteel.client.render.RenderMagicCircle.java

License:Open Source License

public void renderSpellCardCircle(EntityMagicCircle circle, double x, double y, double z, float yaw,
        float pitch) {
    GL11.glPushMatrix();//from   w  w  w.  ja v  a  2  s  .  c  o  m
    bindEntityTexture(circle);
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR);
    float size = circle.getCircleSize() * 6.0F;
    GL11.glScalef(size, size, size);
    Tessellator tessellator = Tessellator.instance;
    float umin = 0.0F;
    float umax = 1.0F;
    float vmin = 0.0F;
    float vmax = 1.0F;

    boolean rainbow = false;
    int color = circle.getCircleType();

    if (color >= 16) {
        float angle = MathHelper.sin(2F * (float) circle.getAnimationCount() / 180F * (float) Math.PI) * 40F;
        GL11.glRotatef(180F - renderManager.playerViewY + angle, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-renderManager.playerViewX - angle, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(circle.getAnimationCount() * 5F, 0.0F, 0.0F, 1.0F);
        color %= 16;
    } else {
        GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(circle.getAnimationCount() * 5F, 0.0F, 0.0F, 1.0F);
    }

    if (color == 9) {
        rainbow = true;
    } else {
        color %= 8;
    }

    tessellator.startDrawingQuads();

    if (rainbow) {
        float rainbowTime = circle.ticksExisted / 3.0F;
        tessellator.setColorRGBA_F(MathHelper.sin(rainbowTime), MathHelper.cos(rainbowTime),
                -MathHelper.sin(rainbowTime) * 2F, 1.0F);
    } else {
        tessellator.setColorRGBA_F(colorR[color], colorG[color], colorB[color], 1.0F);
    }
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV(-0.6F, -0.6F, 0.0D, umin, vmax);
    tessellator.addVertexWithUV(0.6F, -0.6F, 0.0D, umax, vmax);
    tessellator.addVertexWithUV(0.6F, 0.6F, 0.0D, umax, vmin);
    tessellator.addVertexWithUV(-0.6F, 0.6F, 0.0D, umin, vmin);
    tessellator.draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

From source file:lyonlancer5.pfsteel.common.event.RenderXPEventHandler.java

License:Open Source License

@SubscribeEvent
public void renderXP(RenderGameOverlayEvent.Pre event) {
    if (event.type == RenderGameOverlayEvent.ElementType.EXPERIENCE) {
        ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
        int k = res.getScaledWidth();
        int l = res.getScaledHeight();

        EntityPlayer player = this.mc.thePlayer;
        if (!player.capabilities.isCreativeMode) {
            float xpLeft = expCost(player.experienceLevel);
            float xp = player.experience;
            String xpStr = (int) (xpLeft * xp) + "/" + (int) xpLeft;

            GL11.glScalef(1.0F, 1.0F, 1.0F);
            FontRenderer font = this.mc.fontRenderer;
            int j2 = (k - font.getStringWidth(xpStr)) / 2;
            int k2 = l - 48;

            font.drawStringWithShadow(xpStr, j2, k2, new Color(255, 255, 255, 255).getRGB());
        }//  w w  w  .  jav a2 s  .c o  m
        GL11.glScalef(1.0F, 1.0F, 1.0F);
        this.mc.renderEngine.bindTexture(new ResourceLocation("textures/gui/icons.png"));
    }
}

From source file:makeo.gadomancy.client.gui.InfusionClawGui.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glEnable(GL11.GL_BLEND);/*from ww  w  .j  a  v a2s . c o  m*/

    this.mc.renderEngine.bindTexture(BACKGROUND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);

    int baseX = this.guiLeft;
    int baseY = this.guiTop;

    drawTexturedModalRect(baseX + 114, baseY + 36, 244, 19, 8, 8);

    boolean isLocked = ((TileInfusionClaw) container.clawInv).isLocked();
    if (isLocked) {
        drawTexturedModalRect(baseX + 114, baseY + 36, 244, 27, 8, 8);
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(baseX + 124, baseY + 38, 0);
    GL11.glScalef(0.5F, 0.5F, 0.0F);
    this.fontRendererObj.drawString(StatCollector.translateToLocal("gadomancy.info.InfusionClaw.lock"), 0, 0,
            ColorHelper.toHex(isLocked ? Color.WHITE : Color.GRAY));
    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_BLEND);
}

From source file:makeo.gadomancy.client.renderers.entity.RenderGolemHelper.java

License:LGPL

public static void renderToolItem(EntityGolemBase golem, ItemStack itemstack, ModelBase mainModel,
        RenderManager renderManager) {//  w  w w  .  ja  va 2  s  .  c o  m
    GL11.glPushMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    float angle = (float) (0.195 * Math.PI / -1 * ((ModelGolem) mainModel).golemRightArm.rotateAngleX);

    float y = (float) (Math.cos(angle) * 1.15);
    float z = (float) (Math.sin(angle) * 1.15);

    GL11.glTranslatef(-0.25F, y, z * -0.5f);

    GL11.glRotated(angle / Math.PI * 180f, -1, 0, 0);

    float fs = 0.66F;
    GL11.glScalef(fs, fs, fs);

    net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient
            .getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
    boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(
            net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack,
            net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));

    Item item = itemstack.getItem();
    float f1;

    if (item instanceof ItemBlock
            && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType()))) {
        f1 = 0.5F;
        GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
        f1 *= 0.75F;
        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(-f1, -f1, f1);
    } else if (item == Items.bow) {
        f1 = 0.625F;
        GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
        GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    } else if (item.isFull3D()) {
        f1 = 0.625F;

        if (item.shouldRotateAroundWhenRendering()) {
            GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0.0F, -0.125F, 0.0F);
        }

        GL11.glTranslatef(0.0F, 0.1875F, 0.0F);

        GL11.glScalef(f1, -f1, f1);
        GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    } else {
        f1 = 0.375F;
        GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
        GL11.glScalef(f1, f1, f1);
        GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
    }

    float f2;
    int i;
    float f5;

    if (itemstack.getItem().requiresMultipleRenderPasses()) {
        for (i = 0; i < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++i) {
            int j = itemstack.getItem().getColorFromItemStack(itemstack, i);
            f5 = (float) (j >> 16 & 255) / 255.0F;
            f2 = (float) (j >> 8 & 255) / 255.0F;
            float f3 = (float) (j & 255) / 255.0F;
            GL11.glColor4f(f5, f2, f3, 1.0F);

            renderManager.itemRenderer.renderItem(golem, itemstack, i);
        }
    } else {
        i = itemstack.getItem().getColorFromItemStack(itemstack, 0);
        float f4 = (float) (i >> 16 & 255) / 255.0F;
        f5 = (float) (i >> 8 & 255) / 255.0F;
        f2 = (float) (i & 255) / 255.0F;
        GL11.glColor4f(f4, f5, f2, 1.0F);

        renderManager.itemRenderer.renderItem(golem, itemstack, 0);
    }

    GL11.glScaled(1.0D, 1.0D, 1.0D);

    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileArcaneDropper.java

License:LGPL

public void renderBellow() {
    GL11.glPushMatrix();//  w w w  . jav  a 2  s  . c o m

    GL11.glTranslatef(0, 0.75f, 0.25f);
    GL11.glRotatef(90f, 0, 1, 0);
    GL11.glTranslatef(-0.05f, 0.03f, 0f);
    GL11.glScalef(0.6f, 0.44f, 0.55f);

    BELLOWS_RENDERER.renderEntityAt(BELLOWS_TILE, 0, 0, 0, 0);

    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java

License:LGPL

private void renderCircle(TileInfusionClaw tile, float elapsed) {
    GL11.glPushMatrix();/* w  w  w  .  j  av  a 2s  .  co  m*/

    float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[9]));
    if (speed > 50) {
        speed = 50;
    }

    if (tile.animationStates[9] > 0) {
        tile.animationStates[9] += 0.5 * elapsed;

        if (tile.animationStates[9] > 20 * 5f) {
            tile.animationStates[9] = -tile.animationStates[9];

            ItemStack wandStack = tile.getStackInSlot(0);
            if (wandStack != null) {
                tile.animationStates[11] = ((ItemWandCasting) wandStack.getItem()).isStaff(wandStack) ? 0.5f
                        : 0.1f;
            }
        }
    } else if (tile.animationStates[9] < 0) {
        tile.animationStates[9] += elapsed * 0.5;

        if (tile.animationStates[9] > 0) {
            tile.animationStates[9] = 0;
        }
    }

    for (int i = 0; i < 4; i++) {
        GL11.glPushMatrix();

        tile.animationStates[10] += speed * (elapsed * 0.001 * Math.PI);

        float angle = (float) (tile.animationStates[10] + (i * 0.5 * Math.PI));
        float x = (float) Math.sin(angle);
        float y = (float) Math.cos(angle);
        float radius = 0.25f;

        GL11.glTranslated(0, (1f / 16f) * Math.sin(angle / 1.4) + (1f / 16f), 0);
        GL11.glTranslated(radius * x, -0.27, radius * y);
        GL11.glRotated(45, Math.cos(angle), 0, -Math.sin(angle));
        GL11.glScalef(0.75f, 0.75f, 0.75f);

        renderPart(i);

        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java

License:LGPL

private void renderWand(ItemStack wandStack, float ticks) {
    GL11.glRotatef(((ticks / 3) / 20.0F) * (180F / (float) Math.PI), 0, 1f, 0);

    renderTopPart();/*from   w w w  . j av  a  2  s.c  o m*/

    if (wandStack != null && wandStack.stackSize > 0) {
        GL11.glPushMatrix();

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wandFocusStack = wandStack.copy();
        item.setFocus(wandFocusStack, new ItemStack(ConfigItems.itemFocusPrimal));

        GL11.glRotatef(180, 1, 0, 0);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0);

        GL11.glTranslatef(0, -1.4924f, 0);
        if (item.isStaff(wandFocusStack)) {
            GL11.glTranslatef(0, -0.5f, 0);

            STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        } else {
            WAND_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        }
        GL11.glPopMatrix();
    }
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java

License:LGPL

private void renderTopPart() {
    GL11.glPushMatrix();
    GL11.glTranslatef(0, (0.5f - (1f / 16f * 0.75f)), 0);
    GL11.glScalef(0.75f, 0.75f, 0.75f);

    renderPart(4);

    GL11.glPopMatrix();
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java

License:LGPL

private void renderPrimalOrb(TileInfusionClaw tile, float elapsed) {
    if (tile.animationStates[11] > 0) {
        tile.animationStates[11] += elapsed / 70f;

        GL11.glPushMatrix();/*from w  ww. j  a  v  a  2 s.  c  om*/

        GL11.glTranslatef(0.5f, 0.75f - tile.animationStates[11], 0.5f);
        GL11.glScalef(0.35f, 0.35f, 0.35f);

        EntityPrimalOrb orb = new EntityPrimalOrb(tile.getWorldObj(), Minecraft.getMinecraft().thePlayer, true);
        orb.ticksExisted = Minecraft.getMinecraft().renderViewEntity.ticksExisted;

        RENDER_PRIMAL_ORB.renderEntityAt(orb, 0, 0, 0, 0, 0);

        GL11.glPopMatrix();

        if (0.75f - tile.animationStates[11] < -0.5f) {
            tile.animationStates[11] = 0;
        }
    }
}

From source file:makeo.gadomancy.client.renderers.tile.RenderTileInfusionClaw.java

License:LGPL

private void renderSides(TileInfusionClaw tile, World world, int x, int y, int z, float elapsed) {
    GL11.glPushMatrix();/*from   www.  ja  v  a2 s.co m*/

    float speed = (float) Math.pow(1.1, Math.abs(tile.animationStates[8]));
    if (tile.animationStates[8] > 0) {
        tile.animationStates[8] += elapsed;

        if (tile.animationStates[8] > 20 * 2.5f) {
            tile.animationStates[8] = -tile.animationStates[8];
            tile.animationStates[9] = 1;

            createSideZap(tile);
        }
    } else if (tile.animationStates[8] < 0) {
        tile.animationStates[8] += elapsed * 0.5;

        if (tile.animationStates[8] > 0) {
            tile.animationStates[8] = 0;
        }
    }

    for (int i = 0; i < 4; i++) {
        float heightMove = getNextMoveOffset(tile, i, speed, elapsed);
        float widthMove = getNextMoveOffset(tile, i + 4, speed, elapsed);

        ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
        boolean powered = world != null
                && world.getIndirectPowerLevelTo(x + dir.offsetX, y, z + dir.offsetZ, dir.ordinal()) > 0;

        GL11.glPushMatrix();

        GL11.glTranslatef(-dir.offsetZ * widthMove, heightMove, -dir.offsetX * widthMove);
        GL11.glTranslated((0.5 - (1f / 16f * 0.75)) * dir.offsetX, 0, (0.5 - (1f / 16f * 0.75)) * dir.offsetZ);
        GL11.glRotatef(90, -1 * dir.offsetZ, 0, dir.offsetX);

        GL11.glScalef(0.75f, 0.75f, 0.75f);

        renderRedstonePart(powered);

        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}