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:makeo.gadomancy.client.renderers.tile.RenderTileRemoteJar.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/*  www  . ja va 2 s .  c  o m*/
    GL11.glTranslated(x, y, z);

    GL11.glPushMatrix();

    GL11.glTranslatef(0.45f / 2, 0.003f, 0.45f / 2);
    GL11.glScalef(0.55f, 1, 0.55f);

    TileMirrorRenderer renderer = new TileMirrorRenderer();

    renderer.func_147497_a(this.field_147501_a);

    if (field_147501_a.field_147553_e != null) {
        renderer.renderTileEntityAt(createFakeTile(tile, BlockRemoteJar.getJarTile(tile).networkId != null), 0,
                0, 0, partialTicks);
    }

    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glTranslatef(0.5f, 0.002f, 0.5f);
    GL11.glRotatef(180, 0, 0, 1);

    bindTexture(OVERLAY_TEXTURE);

    GL11.glScalef(1.002f, 1f, 1.002f);

    GL11.glTranslatef(0, -1.5f, 0);
    //GL11.glRotatef(180, 1f, 0, 0);

    MODEL_JAR_POT.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f);

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

    super.renderTileEntityAt(tile, x, y, z, partialTicks);
}

From source file:mal.carbonization.gui.GuiAutocraftingBench.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  *///from  ww  w.  j ava2 s. c  om
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    if (!bench.disableButtons)
        this.fontRendererObj.drawString(((Integer) bench.getFuelUsagePercent()).toString(), 79, 68, 4210752);

    GL11.glScalef(0.75f, 0.75f, 0.75f);
    this.fontRendererObj.drawString("Autocrafting Bench", 64, 5, 4210752);
    GL11.glScalef(1.335f, 1.335f, 1.35f);
}

From source file:mal.carbonization.gui.GuiFluidTransport.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  *///from w  ww  .  j  a v  a 2  s  .  c o  m
protected void drawGuiContainerForegroundLayer(int par1, int par2) {

    GL11.glScalef(0.75f, 0.75f, 0.75f);
    this.fontRendererObj.drawString("Fluid Container", 10, 5, 4210752);
    GL11.glScalef(1.335f, 1.335f, 1.35f);
}

From source file:mal.carbonization.gui.GuiFuelConverter.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  */// w ww .j a  v  a  2 s. c o m
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    //this.fontRenderer.drawString(((Integer)bench.getFuelUsagePercent()).toString(), 79, 68, 4210752);
    GL11.glScalef(0.75f, 0.75f, 0.75f);
    this.fontRendererObj.drawString("Fuel Conversion Bench", 54, 6, 4210752);
    GL11.glScalef(1.335f, 1.335f, 1.35f);
}

From source file:mal.carbonization.gui.GuiPortableScanner.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  *//*from   www  .j  a v  a2  s .  c o m*/
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    GL11.glScalef(1f, 1f, 1f);

    int xsize = ((ItemPortableScanner) scanner.getStack().getItem()).getSizeDim(scanner.getStack(), 0);
    int ysize = ((ItemPortableScanner) scanner.getStack().getItem()).getSizeDim(scanner.getStack(), 1);
    int zsize = ((ItemPortableScanner) scanner.getStack().getItem()).getSizeDim(scanner.getStack(), 2);
    this.fontRendererObj.drawString(Integer.toString(xsize), 10, 30, 4210752);
    this.fontRendererObj.drawString(Integer.toString(ysize), 29, 30, 4210752);
    this.fontRendererObj.drawString(Integer.toString(zsize), 47, 30, 4210752);

    this.fontRendererObj.drawString("Total Volume: " + xsize * ysize * zsize, 8, 42, 4210752);
    int mode = ((ItemPortableScanner) scanner.getStack().getItem()).getMode(scanner.getStack());
    this.fontRendererObj.drawString("Mode: " + ((mode == 0) ? ("Basic") : ("Extended")), 8, 52, 4210752);
}

From source file:mal.carbonization.gui.GuiTunnelBore.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  *//* w  w w.  j a  v a 2s . c o m*/
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    GL11.glScalef(1f, 1f, 1f);

    int xsize = bore.xSize;
    int ysize = bore.ySize;
    this.fontRendererObj.drawString(Integer.toString(xsize), 10, 30, 4210752);
    this.fontRendererObj.drawString(Integer.toString(ysize), 29, 30, 4210752);

    this.fontRendererObj.drawString("Total Volume: " + xsize * ysize, 8, 42, 4210752);
}

From source file:mal.carbonization.render.FluidTransportItemRenderer.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();//from  ww  w  .j a  v a 2s .  c  om

    GL11.glScalef(1.6f, 1.6f, 1.6f);
    ResourceLocation texture = new ResourceLocation("carbonization",
            "textures/blocks/fluidTransportTexture.png");
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);

    switch (type) {
    case ENTITY:
        GL11.glTranslatef(-0.4f, 0.0f, -0.4f);
        break;
    case EQUIPPED:
        break;
    case EQUIPPED_FIRST_PERSON:
        break;
    case FIRST_PERSON_MAP:
        break;
    case INVENTORY:
        GL11.glTranslatef(0.0f, -0.06f, 0.0f);
        break;
    default:
        break;

    }

    this.model.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:mal.carbonization.render.FluidTransportRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
    GL11.glPushMatrix();/* ww w. j  ava 2s  .co m*/
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glScalef(1.6f, 1.6f, 1.6f);
    ResourceLocation texture = new ResourceLocation("carbonization",
            "textures/blocks/fluidTransportTexture.png");
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);

    GL11.glPushMatrix();
    model.render(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.0625f);
    GL11.glPopMatrix();
    GL11.glPopMatrix();

    Tessellator tessellator = Tessellator.instance;

    if (te instanceof TileEntityFluidTransport) {
        TileEntityFluidTransport fte = (TileEntityFluidTransport) te;

        FluidStack fs = fte.getFluid();
        if (fs != null) {
            IIcon icon = fte.getFluid().getFluid().getIcon(fte.getFluid());
            //System.out.println(icon.getIconName());
            if (icon != null) {
                double yscale = fte.getFuelCapacityScaled(90) / 100;
                Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
                GL11.glPushMatrix();
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_CULL_FACE);
                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
                tessellator.startDrawingQuads();
                // xpos face textures
                if (icon != null) {
                    //renderer.renderFaceXPos(block, x, y, z, icon);
                    tessellator.setNormal(1.0F, 1.0F, 0.0F);
                    tessellator.addVertexWithUV(x + 0.91, y + 0.1, z + 0.1, (double) icon.getMaxU(),
                            (double) icon.getMaxV());
                    tessellator.addVertexWithUV(x + 0.91, y + yscale, z + 0.1, (double) icon.getMaxU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.91, y + yscale, z + 0.9, (double) icon.getMinU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.91, y + 0.1, z + 0.9, (double) icon.getMinU(),
                            (double) icon.getMaxV());
                }
                tessellator.draw();

                tessellator.startDrawingQuads();
                // xneg face textures
                if (icon != null) {
                    //                   renderer.renderFaceXNeg(block, x, y, z, icon);
                    tessellator.setNormal(-1.0F, 1.0F, 0.0F);
                    tessellator.addVertexWithUV(x + 0.09, y + 0.1, z + 0.9, (double) icon.getMaxU(),
                            (double) icon.getMaxV());
                    tessellator.addVertexWithUV(x + 0.09, y + yscale, z + 0.9, (double) icon.getMaxU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.09, y + yscale, z + 0.1, (double) icon.getMinU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.09, y + 0.1, z + 0.1, (double) icon.getMinU(),
                            (double) icon.getMaxV());
                }
                tessellator.draw();

                tessellator.startDrawingQuads();
                // zneg face textures
                if (icon != null) {
                    //                   renderer.renderFaceZNeg(block, x, y, z, icon);
                    tessellator.setNormal(0.0F, 1.0F, -1.0F);
                    tessellator.addVertexWithUV(x + 0.1, y + 0.1, z + 0.09, (double) icon.getMaxU(),
                            (double) icon.getMaxV());
                    tessellator.addVertexWithUV(x + 0.1, y + yscale, z + 0.09, (double) icon.getMaxU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.9, y + yscale, z + 0.09, (double) icon.getMinU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.9, y + 0.1, z + 0.09, (double) icon.getMinU(),
                            (double) icon.getMaxV());
                }
                tessellator.draw();

                tessellator.startDrawingQuads();
                // zpos face textures
                if (icon != null) {
                    //                   renderer.renderFaceZPos(block, x, y, z, icon);
                    tessellator.setNormal(0.0F, 1.0F, 1.0F);
                    tessellator.addVertexWithUV(x + 0.9, y + 0.1, z + 0.91, (double) icon.getMaxU(),
                            (double) icon.getMaxV());
                    tessellator.addVertexWithUV(x + 0.9, y + yscale, z + 0.91, (double) icon.getMaxU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.1, y + yscale, z + 0.91, (double) icon.getMinU(),
                            (double) icon.getMinV());
                    tessellator.addVertexWithUV(x + 0.1, y + 0.1, z + 0.91, (double) icon.getMinU(),
                            (double) icon.getMaxV());
                }
                tessellator.draw();
                GL11.glPopMatrix();
            }
        }
    }
}

From source file:mal.carbonization.render.StructureItemRenderer.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    Tessellator tessellator = Tessellator.instance;

    //verify that the item is a ItemStructureBlock
    if (!(item.getItem() instanceof ItemStructureBlock))
        return;/*from   w w  w .j  a  va2s  . co m*/
    GL11.glPushMatrix();
    //      GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    //        GL11.glEnable(GL11.GL_BLEND);
    tessellator.startDrawingQuads();

    // adjust rendering space to match what caller expects
    boolean mustundotranslate = false;
    switch (type) {
    case EQUIPPED:
        break;
    case INVENTORY:
        GL11.glTranslatef(0.0f, -0.08f, 0.0f);
        break;
    case EQUIPPED_FIRST_PERSON: {
        break;
    }
    case ENTITY: {
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
        break;
    }
    default:
        break; // never here
    }

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

        IIcon icon;
        // xpos face textures
        icon = item.getItem().getIconFromDamageForRenderPass(item.getItemDamage(), i);
        if (icon != null) {
            tessellator.setNormal(1.0F, 0.0F, 0.0F);
            tessellator.addVertexWithUV(1.0, 0.0, 0.0, (double) icon.getMaxU(), (double) icon.getMaxV());
            tessellator.addVertexWithUV(1.0, 1.0, 0.0, (double) icon.getMaxU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(1.0, 1.0, 1.0, (double) icon.getMinU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(1.0, 0.0, 1.0, (double) icon.getMinU(), (double) icon.getMaxV());
        }

        // xneg face textures
        icon = item.getItem().getIconFromDamageForRenderPass(item.getItemDamage(), i);
        if (icon != null) {
            tessellator.setNormal(-1.0F, 0.0F, 0.0F);
            tessellator.addVertexWithUV(0.0, 0.0, 1.0, (double) icon.getMaxU(), (double) icon.getMaxV());
            tessellator.addVertexWithUV(0.0, 1.0, 1.0, (double) icon.getMaxU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(0.0, 1.0, 0.0, (double) icon.getMinU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(0.0, 0.0, 0.0, (double) icon.getMinU(), (double) icon.getMaxV());
        }

        // zneg face textures
        icon = item.getItem().getIconFromDamageForRenderPass(item.getItemDamage(), i);
        if (icon != null) {
            tessellator.setNormal(0.0F, 0.0F, -1.0F);
            tessellator.addVertexWithUV(0.0, 0.0, 0.0, (double) icon.getMaxU(), (double) icon.getMaxV());
            tessellator.addVertexWithUV(0.0, 1.0, 0.0, (double) icon.getMaxU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(1.0, 1.0, 0.0, (double) icon.getMinU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(1.0, 0.0, 0.0, (double) icon.getMinU(), (double) icon.getMaxV());
        }

        // zpos face textures
        icon = item.getItem().getIconFromDamageForRenderPass(item.getItemDamage(), i);
        if (icon != null) {
            tessellator.setNormal(0.0F, 0.0F, -1.0F);
            tessellator.addVertexWithUV(1.0, 0.0, 1.0, (double) icon.getMaxU(), (double) icon.getMaxV());
            tessellator.addVertexWithUV(1.0, 1.0, 1.0, (double) icon.getMaxU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(0.0, 1.0, 1.0, (double) icon.getMinU(), (double) icon.getMinV());
            tessellator.addVertexWithUV(0.0, 0.0, 1.0, (double) icon.getMinU(), (double) icon.getMaxV());
        }

        if (i < 2) {
            // ypos face textures
            icon = item.getItem().getIconFromDamageForRenderPass(item.getItemDamage(), i);
            if (icon != null) {
                tessellator.setNormal(0.0F, 1.0F, 0.0F);
                tessellator.addVertexWithUV(1.0, 1.0, 1.0, (double) icon.getMaxU(), (double) icon.getMaxV());
                tessellator.addVertexWithUV(1.0, 1.0, 0.0, (double) icon.getMaxU(), (double) icon.getMinV());
                tessellator.addVertexWithUV(0.0, 1.0, 0.0, (double) icon.getMinU(), (double) icon.getMinV());
                tessellator.addVertexWithUV(0.0, 1.0, 1.0, (double) icon.getMinU(), (double) icon.getMaxV());
            }

            // yneg face textures
            icon = item.getItem().getIconFromDamageForRenderPass(item.getItemDamage(), i);
            if (icon != null) {
                tessellator.setNormal(0.0F, -1.0F, 0.0F);
                tessellator.addVertexWithUV(0.0, 0.0, 1.0, (double) icon.getMaxU(), (double) icon.getMaxV());
                tessellator.addVertexWithUV(0.0, 0.0, 0.0, (double) icon.getMaxU(), (double) icon.getMinV());
                tessellator.addVertexWithUV(1.0, 0.0, 0.0, (double) icon.getMinU(), (double) icon.getMinV());
                tessellator.addVertexWithUV(1.0, 0.0, 1.0, (double) icon.getMinU(), (double) icon.getMaxV());
            }
        }

    }
    tessellator.draw();
    GL11.glPopMatrix();
    /*      GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_ALPHA_TEST);
            GL11.glDisable(GL11.GL_BLEND);*/

    GL11.glPopMatrix();

}

From source file:mal.core.gui.GuiGuidebook.java

License:Open Source License

/**
  * Draw the foreground layer for the GuiContainer (everything in front of the items)
  *///from ww w .  ja va  2s .  co  m
protected void drawGuiContainerForegroundLayer(boolean item, boolean recipe, boolean uppertext) {
    //put text stuff here later

    this.fontRendererObj.drawString(currentPage + "/" + maxPages, this.width / 2 - 30, this.height / 2 + 86,
            4210752);

    //draw the page name if there is one
    String name = instance.getPage(currentPage).getPageTitle();
    if (name != null && name != "")
        this.fontRendererObj.drawString(name, this.width / 2 - 124, this.height / 2 - 100, 4210752);

    GL11.glScalef(0.5f, 0.5f, 0.5f);
    //draw the upper page text if there is any
    int width = (recipe && item) ? (230) : ((recipe || item) ? (300) : (450));
    String upperText = instance.getPage(currentPage).getUpperText();
    if (upperText != null && upperText != "")
        this.fontRendererObj.drawSplitString(upperText, guiLeft * 2 + 10, guiTop * 2 + 30, width, 4210752);

    //draw the lower page text if there is any
    int l = (recipe || item || uppertext) ? (160) : (60);
    String text = instance.getPage(currentPage).getLowerText();
    if (text != null && text != "")
        this.fontRendererObj.drawSplitString(text, guiLeft * 2 + 10, guiTop * 2 + l, 450, 4210752);
    GL11.glScalef(2.0f, 2.0f, 2.0f);

}