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:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

private void drawPlayer() {
    EntityPlayer player = dev.user;/*from  www. j ava 2 s  .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.gui.GuiPresetSelect.java

License:Open Source License

@Override
public void draw(ScaledResolution sr) {
    int h = sr.getScaledHeight(), w = sr.getScaledWidth();
    GL11.glEnable(GL11.GL_BLEND);/*from  ww w  .  j a  v  a2  s.c o m*/
    GL11.glPushMatrix();
    {
        float x0 = w / 2F, y0 = h / 2F, scale = 0.32F;
        GL11.glTranslated(0, -5, 0);
        GL11.glTranslatef(x0, y0, 0);
        GL11.glScalef(scale, scale, 1);

        HudUtils.setTextureResolution(768, 512);
        RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET);
        long dt = Minecraft.getSystemTime() - lastOpenTime;
        drawSelectionMenu(w, h, dt);
        drawPresetInfo(w, h, dt);
        drawTag(w, h, dt);
    }
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}

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;//from  ww w . ja va  2  s  .  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);//from  w ww . j  a  v a 2 s. c  o 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.misc.client.render.RendererCoin.java

License:Open Source License

@Override
public void doRender(Entity var1, double x, double y, double z, float var8, float var9) {
    EntityThrowingCoin etc = (EntityThrowingCoin) var1;
    EntityPlayer player = etc.player;/*w ww  .j a v  a  2s .  co m*/
    boolean fp = player == Minecraft.getMinecraft().thePlayer
            && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;
    double dt = Minecraft.getSystemTime() - etc.getEntityData().getLong("startTime");
    if (etc.isSync)
        return;
    GL11.glPushMatrix();
    {
        GL11.glTranslated(x, y, z);
        if (fp) {
            GL11.glRotated(player.rotationYaw, 0, -1, 0);
        } else
            GL11.glRotated(player.renderYawOffset, 0, -1, 0);
        GL11.glTranslated(-0.63, -0.60, 0.30);
        float scale = 0.3F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslated(0.5, 0.5, 0);
        GL11.glRotated(dt * 2, etc.axis.xCoord, etc.axis.yCoord, etc.axis.zCoord);
        GL11.glTranslated(-0.5, -0.5, 0);
        RenderUtils.renderItemIn2d(0.0625, ACClientProps.TEX_COIN_FRONT, ACClientProps.TEX_COIN_BACK);
    }
    GL11.glPopMatrix();
}

From source file:cn.academy.vanilla.electromaster.client.renderer.RendererCoinThrowing.java

License:GNU General Public License

@Override
public void doRender(Entity var1, double x, double y, double z, float var8, float var9) {
    EntityCoinThrowing etc = (EntityCoinThrowing) var1;
    EntityPlayer player = etc.player;/*from  ww w  .ja  v  a  2  s. c  o m*/
    boolean fp = player == Minecraft.getMinecraft().thePlayer
            && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;

    double dt = GameTimer.getTime() % 150;

    if (etc.player == null)
        return;
    //If syncedSingle and in client computer, do not render
    if (etc.isSync && player == Minecraft.getMinecraft().thePlayer)
        return;
    if (etc.posY < player.posY)
        return;
    GL11.glPushMatrix();
    {
        //x = player.posX - RenderManager.renderPosX;
        //y = etc.posY - RenderManager.renderPosY;
        //z = player.posZ - RenderManager.renderPosZ;
        if (player == Minecraft.getMinecraft().thePlayer) {
            x = z = 0;
        }

        GL11.glTranslated(x, y, z);
        if (fp) {
            GL11.glRotated(player.rotationYaw, 0, -1, 0);
        } else
            GL11.glRotated(player.renderYawOffset, 0, -1, 0);
        GL11.glTranslated(-0.63, -0.60, 0.30);
        float scale = 0.3F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslated(0.5, 0.5, 0);
        GL11.glRotated((dt * 360.0 / 300.0), etc.axis.xCoord, etc.axis.yCoord, etc.axis.zCoord);
        GL11.glTranslated(-0.5, -0.5, 0);
        RenderUtils.drawEquippedItem(0.0625, Resources.TEX_COIN_FRONT, Resources.TEX_COIN_BACK);
    }
    GL11.glPopMatrix();
}

From source file:cn.academy.vanilla.generic.client.render.RippleMarkRender.java

License:GNU General Public License

@Override
public void doRender(Entity entity, double x, double y, double z, float a, float b) {
    EntityRippleMark mark = (EntityRippleMark) entity;
    long dt = GameTimer.getTime() - mark.creationTime;

    GL11.glDisable(GL11.GL_CULL_FACE);/*from w w  w.  j  av a 2s  . c o  m*/
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);

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

        long mod = (dt - timeOffsets[i]) % CYCLE;
        float size = getSize(mod);

        GL11.glTranslatef(0, getHeight(mod), 0);
        GL11.glScalef(size, 1, size);
        material.color = mark.color.copy();
        material.color.a *= getAlpha(mod);
        mesh.draw(material);

        GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

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 w  w w .ja v  a  2  s.  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.crafting.client.renderer.RenderWire.java

License:Open Source License

private void renderWireBox(Tessellator t, int side, boolean[] theArray) {
    ForgeDirection[] dirs = ForgeDirection.values();
    Vec3 v1 = RenderUtils.newV3(-WIDTH, -WIDTH, -WIDTH), v2 = RenderUtils.newV3(WIDTH, -WIDTH, -WIDTH),
            v3 = RenderUtils.newV3(WIDTH, -WIDTH, WIDTH), v4 = RenderUtils.newV3(-WIDTH, -WIDTH, WIDTH),
            v5 = RenderUtils.newV3(-WIDTH, WIDTH, -WIDTH), v6 = RenderUtils.newV3(WIDTH, WIDTH, -WIDTH),
            v7 = RenderUtils.newV3(WIDTH, WIDTH, WIDTH), v8 = RenderUtils.newV3(-WIDTH, WIDTH, WIDTH);
    GL11.glPushMatrix();//from   w  w w .java  2  s  . c o  m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float dx = 0.0F, dy = 0.0F, dz = 0.0F;
    switch (side) {
    case 0:
        dy = -1;
        break;
    case 1:
        dy = 1;
        break;
    case 4:
        dx = -1;
        break;
    case 5:
        dx = 1;
        break;
    case 2:
        dz = -1;
        break;
    case 3:
        dz = 1;
        break;
    }
    float offset = (0.5F + WIDTH) / 2F;
    GL11.glTranslatef(dx * offset, dy * offset, dz * offset);
    if (side != -1) {
        float scale = 2F;
        GL11.glScalef(Math.abs(dx == 0.0F ? 1 : dx * scale), Math.abs(dy == 0.0F ? 1 : dy * scale),
                Math.abs(dz == 0.0F ? 1 : dz * scale));
    }
    int a = 0;
    for (int i = 0; i < theArray.length; i++)
        if (theArray[i])
            a++;
    for (int i = 0; i < 6; i++) {
        if (!doesRenderSide(side, i, theArray))
            continue;
        Vec3 vec1 = null, vec2 = null, vec3 = null, vec4 = null;
        dx = 0.0F;
        dy = 0.0F;
        dz = 0.0F;
        switch (i) {
        case 0:
            vec1 = v4;
            vec2 = v3;
            vec3 = v2;
            vec4 = v1;
            dy = -1.0F;
            break;
        case 1:
            vec1 = v5;
            vec2 = v6;
            vec3 = v7;
            vec4 = v8;
            dy = 1.0F;
            break;
        case 4:
            vec1 = v1;
            vec2 = v5;
            vec3 = v8;
            vec4 = v4;
            dx = -1.0F;
            break;
        case 5:
            vec1 = v2;
            vec2 = v3;
            vec3 = v7;
            vec4 = v6;
            dx = 1.0F;
            break;
        case 2:
            vec1 = v1;
            vec2 = v2;
            vec3 = v6;
            vec4 = v5;
            dz = -1.0F;
            break;
        case 3:
            vec1 = v4;
            vec2 = v8;
            vec3 = v7;
            vec4 = v3;
            dz = 1.0F;
            break;
        }
        GL11.glPushMatrix();
        if (side == -1) {
            if (a == 1 && theArray[dirs[i].getOpposite().ordinal()])
                RenderUtils.loadTexture(ClientProps.WIRE_MAIN_PATH);
            else
                RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH);
        } else {
            RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH2);
        }

        t.startDrawingQuads();
        t.setNormal(dx, dy, dz);
        RenderUtils.addVertex(vec4, 0.0, 1.0);
        RenderUtils.addVertex(vec3, 1.0, 1.0);
        RenderUtils.addVertex(vec2, 1.0, 0.0);
        RenderUtils.addVertex(vec1, 0.0, 0.0);
        t.draw();
        GL11.glPopMatrix();
    }
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.model.ModelVortigaunt.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);
    GL11.glTranslatef(0.0F, -0.45F, 0.0F);
    GL11.glScalef(1.3F, 1.3F, 1.3F);
    EntityAlienSlave slave = (EntityAlienSlave) entity;
    setRotationAngles(f, f1, f2, f3, f4, f5, slave);
    chest.render(f5);/*from  w w  w.  ja v a 2  s  .c  o  m*/
    stomache.render(f5);
    head.render(f5);
    rarm0.render(f5);
    rarm1.render(f5);
    larm0.render(f5);
    larm1.render(f5);
    tent0.render(f5);
    rhand.render(f5);
    lhand.render(f5);
    if (!slave.isCharging) {
        rfinger0.render(f5);
        rfinger1.render(f5);
        lfinger0.render(f5);
        lfinger1.render(f5);
    }
    rear.render(f5);
    lear.render(f5);
    neck.render(f5);
    collar1.render(f5);
    collar2.render(f5);
    collar3.render(f5);
    lcollar1.render(f5);
    collar4.render(f5);
    collar5.render(f5);
    rcollar1.render(f5);
    rleg0.render(f5);
    lleg0.render(f5);
    rleg1.render(f5);
    lleg1.render(f5);
    rleg2.render(f5);
    lleg2.render(f5);
    rleg3.render(f5);
    lleg3.render(f5);
    rleg4.render(f5);
    rleg5.render(f5);
    lleg4.render(f5);
    lleg5.render(f5);
    collar6.render(f5);
}