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:com.builtbroken.icbm.content.blast.entity.slime.RenderSlimeRain.java

/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime//from w  w  w  . ja  v a 2s  . c om
 */
protected void preRenderCallback(EntitySlimeRain slime, float partialTickTime) {
    float f1 = (float) slime.getSlimeSize();
    float f2 = (slime.prevSquishFactor + (slime.squishFactor - slime.prevSquishFactor) * partialTickTime)
            / (f1 * 0.5F + 1.0F);
    float f3 = 1.0F / (f2 + 1.0F);
    GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
    GL11.glColor3f(slime.color.getRed() / 255F, slime.color.getBlue() / 255F, slime.color.getBlue() / 255F);
}

From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java

public void doRenderFireBall(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_, float scale) {
    GL11.glPushMatrix();//from   w w  w  . j a  va2 s  . co m
    this.renderManager.renderEngine.bindTexture(TextureMap.locationItemsTexture);

    GL11.glTranslatef((float) xx, (float) yy, (float) zz);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(scale / 1.0F, scale / 1.0F, scale / 1.0F);

    IIcon iicon = Items.fire_charge.getIconFromDamage(0);
    Tessellator tessellator = Tessellator.instance;

    float minU = iicon.getMinU();
    float maxU = iicon.getMaxU();
    float minV = iicon.getMinV();
    float maxV = iicon.getMaxV();

    float f7 = 1.0F;
    float f8 = 0.5F;
    float f9 = 0.25F;

    GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV((double) (0.0F - f8), (double) (0.0F - f9), 0.0D, (double) minU, (double) maxV);
    tessellator.addVertexWithUV((double) (f7 - f8), (double) (0.0F - f9), 0.0D, (double) maxU, (double) maxV);
    tessellator.addVertexWithUV((double) (f7 - f8), (double) (1.0F - f9), 0.0D, (double) maxU, (double) minV);
    tessellator.addVertexWithUV((double) (0.0F - f8), (double) (1.0F - f9), 0.0D, (double) minU, (double) minV);
    tessellator.draw();

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

From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java

private void doRenderArrow(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_) {
    GL11.glPushMatrix();//  ww  w.j a  v a 2 s.c  o m
    GL11.glTranslatef((float) xx, (float) yy, (float) zz);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_76986_9_ - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_76986_9_,
            0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (0 + b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) 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, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

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

From source file:com.builtbroken.icbm.content.launcher.block.TileLauncherFrame.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glPushMatrix();//from www .  j  av a2  s  .co m
    GL11.glScalef(1f, 1f, 1f);
    GL11.glTranslatef(-0.0F, -0.5F, 0.0F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE);
    Assets.LAUNCHER_FRAME_BLOCK_MODEL.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.block.TileLauncherFrame.java

@SideOnly(Side.CLIENT)
public void renderDynamic(Pos pos, float frame, int pass) {
    GL11.glPushMatrix();/*  w w  w . j a  v  a  2s . co  m*/
    GL11.glScalef(1f, 1f, 1f);
    GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f);
    if (getMetadata() == 0) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE);
        Assets.LAUNCHER_FRAME_BLOCK_MODEL.renderAll();
    } else {
        int rotation = getMetadata();
        switch (rotation) {
        case 1:
            GL11.glRotatef(180, 0, 1, 0);
            break;
        case 2:
            GL11.glRotatef(0, 0, 1, 0);
            break;
        case 3:
            GL11.glRotatef(90, 0, 1, 0);
            break;
        case 4:
            GL11.glRotatef(-90, 0, 1, 0);
            break;
        }
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE);
        Assets.LAUNCHER_FRAME_BLOCK_TOP_MODEL.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.controller.remote.antenna.ItemRendererAntennaFrame.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    int meta = item.getItemDamage();
    GL11.glPushMatrix();//  www .ja v a  2s. c  o  m
    GL11.glScalef(1f, 1f, 1f);
    GL11.glTranslatef(-0.0F, -0.5F, 0.0F);
    if (meta == 0 || meta == 1) {
        //TODO if meta == 1 change texture to say its connected to a base
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_TOWER_MODEL.renderAll();
    } else if (meta == 2) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_BASE_MODEL.renderAll();
    } else if (meta == 3) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_INTERSECTION_MODEL.renderAll();
    } else if (meta == 4) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_NOTCH_MODEL.renderAll();
    } else if (meta == 5) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_PIKE_MODEL.renderAll();
    } else if (meta == 6) //East West
    {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_ARM2_MODEL.renderAll();
    } else if (meta == 7) //North South
    {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.ANTENNA_TEXTURE);
        Assets.ANTENNA_ARM_MODEL.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.launcher.large.TileLargeLauncher.java

@Override
@SideOnly(Side.CLIENT)/*  ww w .  j  a  va  2 s  .co m*/
public void renderDynamic(Pos pos, float frame, int pass) {
    //Render launcher
    GL11.glPushMatrix();
    GL11.glTranslatef(pos.xf() - 0.5f, pos.yf() + 0.5f, pos.zf() + 2.5f);
    GL11.glScalef(1.5f, 1.5f, 1.5f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
    Assets.STANDARD_MISSILE_MODEL.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.launcher.launcher.standard.TileStandardLauncherClient.java

@Override
@SideOnly(Side.CLIENT)/*from   ww  w. j  av  a  2 s.c  o  m*/
public void renderDynamic(Pos center, float f, int pass) {
    if (missile != null) {
        //Render launcher
        GL11.glPushMatrix();
        Pos pos = center.add(getDirection()).add(0.5, 0, 0.5);
        GL11.glTranslatef(pos.xf(), pos.yf(), pos.zf());
        GL11.glRotatef(45f, 0, 1, 0);
        if (missile instanceof ICustomMissileRender) {
            GL11.glTranslatef(0, ((ICustomMissileRender) missile).getRenderHeightOffset(), 0);
            ((ICustomMissileRender) missile).renderMissileInWorld(0, 0, f);
        }
        GL11.glPopMatrix();
    } else if (recipe != null) {
        if (!processedModel) {
            processModel();
        }
        //Render launcher
        GL11.glPushMatrix();

        Pos pos = center;

        final float yf = 2.2f;
        switch (ForgeDirection.getOrientation(getMetadata())) {
        case NORTH:
            pos = pos.add(-0.65, yf, 0.95);
            break;
        case SOUTH:
            pos = pos.add(-0.65, yf, 2.95);
            break;
        case EAST:
            pos = pos.add(.35, yf, 1.95);
            break;
        case WEST:
            pos = pos.add(-1.65, yf, 1.95);
            break;
        }
        GL11.glTranslatef(pos.xf(), pos.yf(), pos.zf());
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glScalef(0.85f, 0.85f, 0.85f);
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        //TODO render crafting progress
        //TODO render ghost of missile frame

        //Render frame pieces
        for (int i = 0; i < recipe.frameLevel && i < frame.length; i++) {
            frame[i].render();
        }
        //Only render guts of missile if frame is completed
        if (recipe.frameCompleted) {
            if (recipe.warhead != null) {
                warhead.render();
            }
            if (recipe.rocketComputer != null) {
                guidance.render();
            }
            if (recipe.rocketEngine != null) {
                for (GroupObject o : engine) {
                    o.render();
                }
            }
            //Render Skin
            if (recipe.platesContained > 0) {
                for (int i = 0; i < recipe.platesContained; i++) {
                    //TODO fix layers as they are not perfect, could be naming of parts
                    int layer = i / StandardMissileCrafting.PLATE_PER_LEVEL_COUNT;
                    int set = i % StandardMissileCrafting.PLATE_PER_LEVEL_COUNT;
                    if (layer < skinLayers.length) {
                        skinLayers[layer][set].render();
                    }
                }
            }
        }

        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.icbm.content.missile.tile.TileCrashedMissile.java

private final void renderDefaultMissile() {
    GL11.glTranslated(0.5, 2, 0.5);/*  w ww.  java2 s  .co m*/
    GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(pitch - 90, 0.0F, 0.0F, 1.0F);
    GL11.glScalef(.5f, .5f, .5f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.CLASSIC_MISSILE_TEXTURE);
    if (missile == null || missile.getWarhead() != null) {
        Assets.CLASSIC_MISSILE_MODEL.renderOnly("WARHEAD 1", "WARHEAD 2", "WARHEAD 3", "WARHEAD 4");
    }
    Assets.CLASSIC_MISSILE_MODEL.renderAllExcept("WARHEAD 1", "WARHEAD 2", "WARHEAD 3", "WARHEAD 4");
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawRoundedRect(float x, float y, float x1, float y1, int borderC, int insideC) {
    x *= 2;//from   w ww . j a v a 2 s.c om
    y *= 2;
    x1 *= 2;
    y1 *= 2;
    GL11.glScalef(0.5F, 0.5F, 0.5F);
    drawVLine(x, y + 1, y1 - 2, borderC);
    drawVLine(x1 - 1, y + 1, y1 - 2, borderC);
    drawHLine(x + 2, x1 - 3, y, borderC);
    drawHLine(x + 2, x1 - 3, y1 - 1, borderC);
    drawHLine(x + 1, x + 1, y + 1, borderC);
    drawHLine(x1 - 2, x1 - 2, y + 1, borderC);
    drawHLine(x1 - 2, x1 - 2, y1 - 2, borderC);
    drawHLine(x + 1, x + 1, y1 - 2, borderC);
    drawRect(x + 1, y + 1, x1 - 1, y1 - 1, insideC);
    GL11.glScalef(2.0F, 2.0F, 2.0F);
}