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:flamefeed.FlameProtect.src.client.GuiSQL.java

@Override
public void drawScreen(int x, int y, float f) {
    drawDefaultBackground();// w  ww .j  a va2 s . c  o m

    //Anchors
    xAnchor = (int) (width * 0.1F);
    yAnchor = (int) (height * 0.1F);
    curY = yAnchor;

    //Background
    this.mc.renderEngine.bindTexture(new ResourceLocation("textures/map/map_background.png"));
    GL11.glScalef(width / 276.0F, height / 276.0F, 1);
    drawTexturedModalRect(10, 10, 0, 0, 256, 256);
    GL11.glScalef(276.0F / width, 276.0F / height, 1);

    //Texts
    fontRenderer.drawString("Date", xAnchor + 110, curY, 0x000000, false);
    fontRenderer.drawString("x", xAnchor + 220, curY, 0x000000, false);
    fontRenderer.drawString("y", xAnchor + 275, curY, 0x000000, false);
    fontRenderer.drawString("z", xAnchor + 330, curY, 0x000000, false);
    curY += titleRowHeight;

    //resize
    if (width != lastwidth || height != lastheight || values == null) {
        lastwidth = width;
        lastheight = height;
        resize();
    } else {
        curY += (2 * buttonRowHeight);
    }

    //Buttons
    this.buttonList.clear();
    this.buttonList.add(resetButton);
    this.buttonList.add(sqlButton);

    //Textfields
    for (Map.Entry<String, GuiTextField> field : textFields.entrySet()) {
        field.getValue().drawTextBox();
    }

    //SQL Data
    drawSQLResult();

    super.drawScreen(x, y, f);
}

From source file:forestry.apiculture.render.BeeItemRenderer.java

License:Open Source License

private void renderBeeItem(IBee bee, float translateX, float translateY, float translateZ) {
    float yaw = 1;
    float pitch = 1;

    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);/*from  ww  w  . ja va 2  s. co m*/
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);

    GL11.glPushMatrix();

    GL11.glScalef(2.0f, 2.0f, 2.0f);
    GL11.glTranslatef(translateX, translateY, translateZ);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F);

    entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F;
    entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F;
    entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F;
    entity.rotationYawHead = entity.rotationYaw;

    RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(bee));

    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.glPopAttrib();

}

From source file:forestry.apiculture.render.BeeItemRenderer.java

License:Open Source License

private void renderBeeInInventory(IBee bee) {

    /*/*from w w  w . ja v  a2  s  .  co m*/
    GL11.glPushMatrix();
      //GL11.glTranslatef(-0.3f, -2.5f, 0f);
      GL11.glScalef(-1.0f, 1.0f, 1.0f);
      //GL11.glScalef((float)Math.PI / 2, 1.0f, 1.0f);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
      //GL11.glRotatef(-((float) Math.atan((double) (1 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
      renderBeeHalo();
      GL11.glPopMatrix();
     */

    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    RenderHelper.enableStandardItemLighting();

    GL11.glPushMatrix();

    GL11.glTranslatef(-0.3f, -2.5f, 0f);
    GL11.glScalef(-3.0f, 3.0f, 3.0f);
    GL11.glRotatef(32.0F, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.6f, 1f, 1f);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    entity.renderYawOffset = 0;
    entity.rotationYaw = 0;
    entity.rotationPitch = 0;
    entity.rotationYawHead = entity.rotationYaw;

    RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(bee));

    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.glPopAttrib();
}

From source file:forestry.apiculture.render.ModelBee.java

License:Open Source License

public void render(Entity entity, float f, float f1, float swing, float f3, float f4, float f5) {
    super.render(entity, f, f1, swing, f3, f4, f5);
    //setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    wingRight.rotateAngleZ = MathHelper.cos(swing * 1.3F) * (float) Math.PI * 0.25F;
    wingLeft.rotateAngleZ = -wingRight.rotateAngleZ;

    GL11.glPushMatrix();/*from   w w w.  j a  v  a2  s  . c o  m*/
    float scale = 0.75f;
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(0.0F, (12.0f / scale) * f5, 0.0F);

    snout.render(f5);
    torsoWing.render(f5);
    rump.render(f5);
    tail.render(f5);
    tailEnd.render(f5);
    bridge.render(f5);
    eyeRight.render(f5);
    eyeLeft.render(f5);
    wingLeft.render(f5);
    wingRight.render(f5);

    if (type == EnumBeeType.PRINCESS) {
        crownPrincess.render(f5);
    } else if (type == EnumBeeType.QUEEN) {
        crownQueen.render(f5);
    }

    GL11.glPopMatrix();
}

From source file:forestry.core.gui.GuiForestry.java

License:Open Source License

protected final void startPage() {
    line = 12;
    GL11.glPushMatrix();
    GL11.glScalef(factor, factor, factor);
}

From source file:forestry.core.render.CrateRenderingHandler.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
    if (type == ItemRenderType.INVENTORY) {
        render(ItemRenderType.INVENTORY, stack);
    } else if (type == ItemRenderType.ENTITY) {
        if (RenderManager.instance.options.fancyGraphics) {
            renderAsEntity(stack, (EntityItem) data[1]);
        } else {// w  ww.  ja  va 2  s.  c o  m
            renderAsEntityFlat(stack);
        }
    } else if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glPushMatrix();
        renderEquipped(stack);

        ItemStack contained = getContainedFromCrate(stack);

        if (contained != null) {
            float scale = 0.5f;
            GL11.glScalef(scale, scale, 1.1f);
            GL11.glTranslatef(10f * PIXEL, 8f * PIXEL, 0.001f);
            if (contained.getItem() instanceof ItemBlock) {
                renderIn3D(contained);
            } else {
                renderEquipped(contained);
            }
        }
        GL11.glPopMatrix();
    }
}

From source file:forestry.core.render.CrateRenderingHandler.java

License:Open Source License

private void renderAsEntity(ItemStack stack, EntityItem entity) {
    GL11.glPushMatrix();/*from   w w w. j ava  2  s .  c  o m*/
    byte iterations = 1;
    if (stack.stackSize > 1) {
        iterations = 2;
    }
    if (stack.stackSize > 15) {
        iterations = 3;
    }
    if (stack.stackSize > 31) {
        iterations = 4;
    }

    Random rand = new Random(187L);

    float offsetZ = PIXEL + 0.021875F;

    GL11.glRotatef((((float) entity.age + 1.0F) / 20.0F + entity.hoverStart) * (180F / (float) Math.PI), 0.0F,
            1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.25F, -(offsetZ * (float) iterations / 2.0F));

    for (int count = 0; count < iterations; ++count) {
        if (count > 0) {
            float offsetX = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float offsetY = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            GL11.glTranslatef(offsetX, offsetY, offsetZ);
        } else {
            GL11.glTranslatef(0f, 0f, offsetZ);
        }

        renderIn3D(stack);

        ItemStack contained = getContainedFromCrate(stack);

        if (contained != null) {
            GL11.glPushMatrix();
            float scale = 0.5f;
            GL11.glScalef(scale, scale, 1.1F);
            GL11.glTranslatef(10.0f * PIXEL, 8.0f * PIXEL, 0.003F);
            renderIn3D(contained);
            GL11.glPopMatrix();
        }
    }
    GL11.glPopMatrix();
}

From source file:forestry.core.render.CrateRenderingHandler.java

License:Open Source License

private void renderIn3D(ItemStack stack) {
    GL11.glPushMatrix();//from  w  w w . ja  v a 2  s  . c o m
    Tessellator tessellator = Tessellator.instance;
    if (RenderManager.instance.renderEngine == null) {
        return;
    }

    int meta = stack.getItemDamage();
    for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) {
        IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass);
        if (icon == null) {
            continue;
        }

        if (renderItem.renderWithColor) {
            int color = stack.getItem().getColorFromItemStack(stack, pass);
            float c1 = (float) (color >> 16 & 255) / 255.0F;
            float c2 = (float) (color >> 8 & 255) / 255.0F;
            float c3 = (float) (color & 255) / 255.0F;

            GL11.glColor4f(c1, c2, c3, 1.0F);
        }

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

        if (stack.getItemSpriteNumber() == 0) {
            RenderManager.instance.renderEngine.bindTexture(BLOCK_TEXTURE);
        } else {
            RenderManager.instance.renderEngine.bindTexture(ITEM_TEXTURE);
        }

        ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(),
                icon.getIconHeight(), PIXEL);

        if (stack.hasEffect(pass)) {
            GL11.glDepthFunc(GL11.GL_EQUAL);
            GL11.glDisable(GL11.GL_LIGHTING);
            RenderManager.instance.renderEngine.bindTexture(GLINT_TEXTURE);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
            float f13 = 0.76F;
            GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glPushMatrix();
            float f14 = 0.125F;
            GL11.glScalef(f14, f14, f14);
            float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
            GL11.glTranslatef(f15, 0.0F, 0.0F);
            GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, PIXEL);
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            GL11.glScalef(f14, f14, f14);
            f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
            GL11.glTranslatef(-f15, 0.0F, 0.0F);
            GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, PIXEL);
            GL11.glPopMatrix();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDepthFunc(GL11.GL_LEQUAL);
        }
    }

    GL11.glPopMatrix();
}

From source file:forestry.core.render.CrateRenderingHandler.java

License:Open Source License

private void render(ItemRenderType type, ItemStack stack) {
    GL11.glPushMatrix();/*from w  ww  . j  ava2s.c o  m*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    IIcon crateTexture = stack.getIconIndex();
    renderItem.renderIcon(0, 0, crateTexture, 16, 16);

    ItemStack contained = getContainedFromCrate(stack);

    if (contained != null) {

        int meta = contained.getItemDamage();

        float scale = 0.5f;
        GL11.glScalef(scale, scale, 1);
        GL11.glTranslatef(6f, 8f, 0);
        if (type == ItemRenderType.ENTITY) {
            GL11.glTranslatef(0, 0, -0.1f);
        }

        if (contained.getItem() instanceof ItemBlock) {
            GL11.glScalef(16f, 16f, 1f);
            GL11.glTranslatef(1f, 1f, 0.1f);
            GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
            renderIn3D(contained);
        } else {
            for (int pass = 0; pass < contained.getItem().getRenderPasses(meta); ++pass) {
                IIcon containedTexture = contained.getItem().getIconFromDamageForRenderPass(meta, pass);
                if (containedTexture == null) {
                    continue;
                }

                if (renderItem.renderWithColor) {
                    int color = contained.getItem().getColorFromItemStack(contained, pass);
                    float c1 = (float) (color >> 16 & 255) / 255.0F;
                    float c2 = (float) (color >> 8 & 255) / 255.0F;
                    float c3 = (float) (color & 255) / 255.0F;

                    GL11.glColor4f(c1, c2, c3, 1.0F);
                }

                renderItem.renderIcon(0, 0, containedTexture, 16, 16);
            }
        }
    }

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

From source file:forestry.core.render.RenderAnalyzer.java

License:Open Source License

private void render(ItemStack itemstack, World world, ForgeDirection orientation, double x, double y,
        double z) {

    dummyEntityItem.worldObj = world;/*from w  ww .j  a  v  a2  s  . c  om*/

    model.render(orientation, (float) x, (float) y, (float) z);
    if (itemstack == null) {
        return;
    }
    float renderScale = 1.0f;

    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glTranslatef(0.5f, 0.2f, 0.5f);
    GL11.glScalef(renderScale, renderScale, renderScale);
    dummyEntityItem.setEntityItemStack(itemstack);

    if (world.getTotalWorldTime() != lastTick) {
        lastTick = world.getTotalWorldTime();
        dummyEntityItem.onUpdate();
    }
    customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0);
    GL11.glPopMatrix();

}