Example usage for org.lwjgl.opengl GL11 glScaled

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

Introduction

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

Prototype

public static native void glScaled(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glScalef Scalef .

Usage

From source file:com.bluepowermod.client.render.RenderWindmill.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8) {
    TileWindmill mill = (TileWindmill) tile.getWorldObj().getTileEntity(tile.xCoord, tile.yCoord, tile.zCoord);

    GL11.glPushMatrix();//w  w  w.  ja va 2s.co m
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glTranslated(x + .5, y, z + .5);
    GL11.glScaled(.15, .15, .15);
    this.bindTexture(textureLocation);

    GL11.glRotated(mill.turbineTick, 0, 1, 0);
    model.renderAll();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.part.gate.GateRSLatch.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)//from   ww w.  j a v a  2 s  .co  m
public void renderTop(float frame) {

    if (mode % 2 == 1) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glScaled(-1, 1, 1);
        GL11.glTranslated(-0.5, 0, -0.5);

        GL11.glDisable(GL11.GL_CULL_FACE);
    }

    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(
            Refs.MODID + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/base.png"));
    this.renderTop();

    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID
            + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/left_"
            + ((mode % 2 == 0 ? left().getInput() > 0 : right().getInput() > 0) ? "on" : "off") + ".png"));
    renderTop();
    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID
            + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/right_"
            + ((mode % 2 == 0 ? right().getInput() > 0 : left().getInput() > 0) ? "on" : "off") + ".png"));
    renderTop();
    if (mode > 1) {
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName()
                        + "2/front" + "_" + (front().getInput() > 0 ? "on" : "off") + ".png"));
        renderTop();
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName()
                        + "2/back" + "_" + (back().getInput() > 0 ? "on" : "off") + ".png"));
        renderTop();
    }

    RenderHelper.renderDigitalRedstoneTorch(1D / 8D, 3D / 16D, -2D / 8D, 9D / 16D, front().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(-1D / 8D, 3D / 16D, 2D / 8D, 9D / 16D, back().getInput() == 0);

    if (mode % 2 == 1) {
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.part.gate.GateTransparentLatch.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)/*from  w  ww.j a  v  a 2 s .  c  om*/
public void renderTop(float frame) {

    if (mirrored) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glScaled(-1, 1, 1);
        GL11.glTranslated(-0.5, 0, -0.5);

        GL11.glDisable(GL11.GL_CULL_FACE);
    }

    renderTop("front", front());
    renderTop("left", mirrored ? right() : left());
    renderTop("back", back());
    renderTop("leftcenter", back().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(4 / 16D, 3D / 16D, -4 / 16D, 8D / 16D, back().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(4 / 16D, 3D / 16D, 1 / 16D, 8D / 16D,
            back().getInput() > 0 && front().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(1 / 16D, 3D / 16D, 1 / 16D, 8D / 16D,
            back().getInput() == 0 && front().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(-4 / 16D, 2D / 16D, 1 / 16D, 10D / 16D, front().getInput() > 0);
    RenderHelper.renderDigitalRedstoneTorch(2 / 16D, 2D / 16D, 6 / 16D, 10D / 16D, front().getInput() > 0);
    renderTop("right", mirrored ? left() : right());

    if (mirrored) {
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.part.gate.ic.IntegratedCircuit.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)/* w  w  w .  ja va 2 s  . co m*/
protected void renderTop(float frame) {

    renderTop("front", front());
    renderTop("left", left());
    renderTop("back", back());
    renderTop("right", right());
    Vec3d loc = new Vec3d(0, 0, 0);

    RenderHelper rh = RenderHelper.instance;
    rh.reset();
    RenderBlocks rb = RenderBlocks.getInstance();

    GL11.glPushMatrix();
    {
        GL11.glTranslated(0, 2 / 16D - 1 / 16D * (1.0 / getCircuitWidth()), 0);
        GL11.glNormal3d(0, 1, 0);
        int size = getCircuitWidth();
        double textureMaxUV = 0.5 * size;

        Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(
                Refs.MODID + ":textures/blocks/gates/" + getTextureName() + "/checkerboard.png"));
        GL11.glBegin(GL11.GL_QUADS);
        {
            com.bluepowermod.client.render.RenderHelper.addVertexWithTexture(BORDER_WIDTH, 0, BORDER_WIDTH, 0,
                    0);
            com.bluepowermod.client.render.RenderHelper.addVertexWithTexture(BORDER_WIDTH, 0, 1 - BORDER_WIDTH,
                    0, textureMaxUV);
            com.bluepowermod.client.render.RenderHelper.addVertexWithTexture(1 - BORDER_WIDTH, 0,
                    1 - BORDER_WIDTH, textureMaxUV, textureMaxUV);
            com.bluepowermod.client.render.RenderHelper.addVertexWithTexture(1 - BORDER_WIDTH, 0, BORDER_WIDTH,
                    textureMaxUV, 0);
        }
        GL11.glEnd();
    }
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    {
        GL11.glTranslated(BORDER_WIDTH, 2 / 16D + 0.001D, BORDER_WIDTH);
        GL11.glScaled((1 - 2 * BORDER_WIDTH) / 1, 1, (1 - 2 * BORDER_WIDTH) / 1);

        GL11.glScaled(1.0 / getCircuitWidth(), 1.0 / getCircuitWidth(), 1.0 / getCircuitWidth());
        GL11.glTranslated(0, -2 / 16D, 0);
        for (GateBase[] gateArray : gates) {
            GL11.glPushMatrix();
            for (GateBase gate : gateArray) {
                if (gate != null) {
                    GL11.glPushMatrix();
                    gate.renderDynamic(loc, frame, 0);
                    GL11.glPopMatrix();

                    if (!isRenderingItem) {
                        // Static renderer
                        GL11.glPushMatrix();
                        {
                            Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
                            Tessellator.instance.startDrawingQuads();
                            gate.renderStatic(new Vec3i(gate), rh, rb, 0);
                            Tessellator.instance.draw();
                        }
                        GL11.glPopMatrix();
                    }

                    rh.reset();
                }
                GL11.glTranslated(0, 0, 1);
            }
            GL11.glPopMatrix();
            GL11.glTranslated(1, 0, 0);
        }
    }
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.part.tube.TubeStack.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void render(float partialTick) {
    if (renderMode == RenderMode.AUTO) {
        renderMode = Minecraft.getMinecraft().gameSettings.fancyGraphics ? RenderMode.NORMAL
                : RenderMode.REDUCED;/*from w ww .j  av  a2  s. c  o  m*/
    }
    final RenderMode finalRenderMode = renderMode;

    if (customRenderItem == null) {
        customRenderItem = new RenderItem() {

            @Override
            public boolean shouldBob() {

                return false;
            };

            @Override
            public byte getMiniBlockCount(ItemStack stack, byte original) {

                return finalRenderMode == RenderMode.REDUCED ? (byte) 1 : original;
            }
        };
        customRenderItem.setRenderManager(RenderManager.instance);

        renderedItem = new EntityItem(FMLClientHandler.instance().getWorldClient());
        renderedItem.hoverStart = 0.0F;
    }

    renderedItem.setEntityItemStack(stack);

    double renderProgress = (oldProgress + (progress - oldProgress) * partialTick) * 2 - 1;

    GL11.glPushMatrix();
    GL11.glTranslated(heading.offsetX * renderProgress * 0.5, heading.offsetY * renderProgress * 0.5,
            heading.offsetZ * renderProgress * 0.5);
    if (finalRenderMode != RenderMode.NONE) {
        GL11.glPushMatrix();
        if (stack.stackSize > 5) {
            GL11.glScaled(0.8, 0.8, 0.8);
        }
        if (!(stack.getItem() instanceof ItemBlock)) {
            GL11.glScaled(0.8, 0.8, 0.8);
            GL11.glTranslated(0, -0.15, 0);
        }

        customRenderItem.doRender(renderedItem, 0, 0, 0, 0, 0);
        GL11.glPopMatrix();
    } else {
        float size = 0.02F;
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glBegin(GL11.GL_QUADS);
        RenderHelper.drawColoredCube(new Vec3dCube(-size, -size, -size, size, size, size), 1, 1, 1, 1);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }

    if (color != TubeColor.NONE) {

        float size = 0.2F;

        int colorInt = ItemDye.field_150922_c[color.ordinal()];
        float red = (colorInt >> 16) / 256F;
        float green = (colorInt >> 8 & 255) / 256F;
        float blue = (colorInt & 255) / 256F;

        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glColor3f(red, green, blue);
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID, "textures/blocks/tubes/inside_color_border.png"));
        RenderHelper.drawTesselatedTexturedCube(new Vec3dCube(-size, -size, -size, size, size, size));
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.assemblyline.content.inserter.TileInsertArmClient.java

@Override
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
    GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
    GL11.glScaled(.8f, .8f, .8f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model.renderAll();/* w  w w. j a va  2s .c o m*/
}

From source file:com.builtbroken.atomic.content.items.cell.RendererItemCell.java

protected void applyRotation(ItemRenderType type) {
    if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);/*from w w  w .ja  v  a 2 s . co  m*/
        GL11.glRotated(90, 0, 1, 0);
        GL11.glScaled(0.75, 0.75, 0.75);
        GL11.glTranslated(-0.5, -0.6, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    }
}

From source file:com.builtbroken.atomic.content.machines.processing.boiler.render.RenderItemBoiler.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*from ww  w . ja v  a2  s. c  om*/
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture_on);
    model_base.renderAll();
    model_core.renderAll();
    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.processing.boiler.render.TESRChemBoiler.java

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaFrame) {
    GL11.glPushMatrix();//from   ww w. ja v  a  2s. c  o m
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);

    if (tile instanceof TileEntityChemBoiler) {
        TileEntityChemBoiler entityChemExtractor = (TileEntityChemBoiler) tile;
        ForgeDirection facing = entityChemExtractor.getFacingDirection();

        switch (facing) {
        case NORTH:
            GL11.glRotatef(-90, 0, 1, 0);
            break;
        case SOUTH:
            GL11.glRotatef(90, 0, 1, 0);
            break;
        case EAST:
            GL11.glRotatef(180, 0, 1, 0);
            break;
        case WEST:
            //Good by default
            break;
        }

        bindTexture(((TileEntityChemBoiler) tile).processTimer > 0 ? texture_on : texture_off);

        //Render main body
        model_base.renderAll();

        //Render rotating parts
        GL11.glRotatef(((TileEntityChemBoiler) tile).rotate(deltaFrame), 0, 1, 0);
        model_core.renderAll();
    }

    GL11.glPopMatrix();
}

From source file:com.builtbroken.atomic.content.machines.processing.centrifuge.render.RenderItemCentrifuge.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*ww w .  j a v  a2  s.c o  m*/
    GL11.glScaled(0.0625f, 0.0625f, 0.0625f);
    if (type.equals(ItemRenderType.INVENTORY)) {
        GL11.glTranslatef(-0.5f, -0.8f, -0.5f);
        GL11.glRotatef(180f, 0, 1, 0);
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glRotatef(45f, 0, 1, 0);
        GL11.glTranslatef(1f, 12f, 9f);
    } else if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glTranslatef(8f, 10f, 8f);
    }
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
    model_body.renderAll();
    model_core.renderAll();
    GL11.glPopMatrix();
}