Example usage for org.lwjgl.opengl GL12 GL_RESCALE_NORMAL

List of usage examples for org.lwjgl.opengl GL12 GL_RESCALE_NORMAL

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL12 GL_RESCALE_NORMAL.

Prototype

int GL_RESCALE_NORMAL

To view the source code for org.lwjgl.opengl GL12 GL_RESCALE_NORMAL.

Click Source Link

Document

Accepted by the cap parameter of Enable, Disable, and IsEnabled, and by the pname parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev.

Usage

From source file:abo.pipes.fluids.gui.GuiPipeFluidsDiamond.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(TEXTURE);

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    drawBackgroundSlots();//from   ww w  .  j  ava2  s  . co  m
}

From source file:abo.pipes.liquids.gui.GuiPipeLiquidsDiamond.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture("/gfx/abo/gui/pipeLiquidsDiamond.png");

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    drawBackgroundSlots();//from  w w  w  .j  av a2 s  . c  o m
}

From source file:abo.pipes.power.gui.GuiPipePowerDiamond.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(TEXTURE);

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    for (AdvancedSlot slot : slots) {
        if (slot instanceof YesNoSlot) {
            YesNoSlot s = (YesNoSlot) slot;
            drawTexturedModalRect(cornerX + slot.x, cornerY + slot.y, 240, s.isYes() ? 0 : 16, 16, 16);
        }//from  w w  w  .  ja v  a  2  s. com
    }
}

From source file:appeng.client.gui.widgets.GuiTabButton.java

License:Open Source License

@Override
public void drawButton(final Minecraft minecraft, final int x, final int y) {
    if (this.visible) {
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        minecraft.renderEngine.bindTexture(ExtraBlockTextures.GuiTexture("guis/states.png"));
        this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width
                && y < this.yPosition + this.height;

        int uv_x = (this.hideEdge > 0 ? 11 : 13);

        final int offsetX = this.hideEdge > 0 ? 1 : 0;

        this.drawTexturedModalRect(this.xPosition, this.yPosition, uv_x * 16, 0, 25, 22);

        if (this.myIcon >= 0) {
            final int uv_y = (int) Math.floor(this.myIcon / 16);
            uv_x = this.myIcon - uv_y * 16;

            this.drawTexturedModalRect(offsetX + this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16,
                    16, 16);//from   w ww . j ava 2s  .co m
        }

        this.mouseDragged(minecraft, x, y);

        if (this.myItem != null) {
            this.zLevel = 100.0F;
            this.itemRenderer.zLevel = 100.0F;

            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            final FontRenderer fontrenderer = minecraft.fontRenderer;
            this.itemRenderer.renderItemAndEffectIntoGUI(fontrenderer, minecraft.renderEngine, this.myItem,
                    offsetX + this.xPosition + 3, this.yPosition + 3);
            GL11.glDisable(GL11.GL_LIGHTING);

            this.itemRenderer.zLevel = 0.0F;
            this.zLevel = 0.0F;
        }
    }
}

From source file:appeng.client.render.blocks.RenderBlockCharger.java

License:Open Source License

@Override
public void renderTile(final BlockCharger block, final TileCharger tile, final Tessellator tess, final double x,
        final double y, final double z, final float f, final RenderBlocks renderer) {
    final ItemStack sis = tile.getStackInSlot(0);

    if (sis != null) {
        GL11.glPushMatrix();/*  ww  w.  ja v a 2s  .c om*/
        this.applyTESRRotation(x, y, z, tile.getForward(), tile.getUp());

        try {
            GL11.glTranslatef(0.5f, 0.45f, 0.5f);
            GL11.glScalef(1.0f / 1.1f, 1.0f / 1.1f, 1.0f / 1.1f);
            GL11.glScalef(1.0f, 1.0f, 1.0f);

            final Block blk = Block.getBlockFromItem(sis.getItem());
            if (sis.getItemSpriteNumber() == 0 && block != null
                    && RenderBlocks.renderItemIn3d(blk.getRenderType())) {
                GL11.glRotatef(25.0f, 1.0f, 0.0f, 0.0f);
                GL11.glRotatef(15.0f, 0.0f, 1.0f, 0.0f);
                GL11.glRotatef(30.0f, 0.0f, 1.0f, 0.0f);
            }

            // << 20 | light << 4;
            final int br = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord,
                    tile.zCoord, 0);
            final int var11 = br % 65536;
            final int var12 = br / 65536;

            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11, var12);

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

            this.doRenderItem(sis, tile);
        } catch (final Exception err) {
            AELog.error(err);
        }

        GL11.glPopMatrix();
    }
}

From source file:appeng.client.render.blocks.RenderBlockCraftingCPUMonitor.java

License:Open Source License

private void tesrRenderScreen(final Tessellator tess, final TileCraftingMonitorTile cmt,
        final IAEItemStack ais) {
    final ForgeDirection side = cmt.getForward();

    ForgeDirection walrus = side.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP;
    int spin = 0;

    int max = 5;// w ww.j  a  va 2  s .  c  om
    while (walrus != cmt.getUp() && max > 0) {
        max--;
        spin++;
        walrus = Platform.rotateAround(walrus, side);
    }
    max--;

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glTranslated(side.offsetX * 0.69, side.offsetY * 0.69, side.offsetZ * 0.69);

    final float scale = 0.7f;
    GL11.glScalef(scale, scale, scale);

    if (side == ForgeDirection.UP) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(spin * 90.0F, 0, 0, 1);
    }

    if (side == ForgeDirection.DOWN) {
        GL11.glScalef(1.0f, -1.0f, 1.0f);
        GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        GL11.glRotatef(spin * -90.0F, 0, 0, 1);
    }

    if (side == ForgeDirection.EAST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (side == ForgeDirection.WEST) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
    }

    if (side == ForgeDirection.NORTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
    }

    if (side == ForgeDirection.SOUTH) {
        GL11.glScalef(-1.0f, -1.0f, -1.0f);
        GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f);
    }

    GL11.glPushMatrix();
    try {
        final ItemStack sis = ais.getItemStack();
        sis.stackSize = 1;

        final int br = 16 << 20 | 16 << 4;
        final int var11 = br % 65536;
        final int var12 = br / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        // RenderHelper.enableGUIStandardItemLighting();
        tess.setColorOpaque_F(1.0f, 1.0f, 1.0f);

        ClientHelper.proxy.doRenderItem(sis, cmt.getWorldObj());
    } catch (final Exception e) {
        AELog.error(e);
    }

    GL11.glPopMatrix();

    GL11.glTranslatef(0.0f, 0.14f, -0.24f);
    GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f);

    final long stackSize = ais.getStackSize();
    final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize);

    final FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    final int width = fr.getStringWidth(renderedStackSize);
    GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f);
    fr.drawString(renderedStackSize, 0, 0, 0);

    GL11.glPopAttrib();
}

From source file:appeng.client.render.blocks.RenderBlockInscriber.java

License:Open Source License

@Override
public void renderTile(final BlockInscriber block, final TileInscriber tile, final Tessellator tess,
        final double x, final double y, final double z, final float f, final RenderBlocks renderer) {
    GL11.glPushMatrix();//  w  w  w  . java  2 s.co m
    this.applyTESRRotation(x, y, z, tile.getForward(), tile.getUp());

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);

    // render sides of stamps
    GL11.glCullFace(GL11.GL_FRONT);

    final Minecraft mc = Minecraft.getMinecraft();
    mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);

    // << 20 | light << 4;
    final int br = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord, tile.zCoord, 0);
    final int var11 = br % 65536;
    final int var12 = br / 65536;

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11, var12);

    long absoluteProgress = 0;

    if (tile.isSmash()) {
        final long currentTime = System.currentTimeMillis();
        absoluteProgress = currentTime - tile.getClientStart();
        if (absoluteProgress > 800) {
            tile.setSmash(false);
        }
    }

    final float relativeProgress = absoluteProgress % 800 / 400.0f;
    float progress = relativeProgress;

    if (progress > 1.0f) {
        progress = 1.0f - (progress - 1.0f);
    }
    float press = 0.2f;
    press -= progress / 5.0f;

    final IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
    tess.startDrawingQuads();

    float middle = 0.5f;
    middle += 0.02f;
    final float TwoPx = 2.0f / 16.0f;
    tess.addVertexWithUV(TwoPx, middle + press, TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(2));
    tess.addVertexWithUV(1.0 - TwoPx, middle + press, TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(2));
    tess.addVertexWithUV(1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(14),
            ic.getInterpolatedV(13));
    tess.addVertexWithUV(TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(13));

    tess.addVertexWithUV(TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(3));
    tess.addVertexWithUV(1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(14),
            ic.getInterpolatedV(3));
    final float base = 0.4f;
    tess.addVertexWithUV(1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU(14),
            ic.getInterpolatedV(3 - 16 * (press - base)));
    tess.addVertexWithUV(TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU(2),
            ic.getInterpolatedV(3 - 16 * (press - base)));

    middle -= 2.0f * 0.02f;
    tess.addVertexWithUV(1.0 - TwoPx, middle - press, TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(2));
    tess.addVertexWithUV(TwoPx, middle - press, TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(2));
    tess.addVertexWithUV(TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(13));
    tess.addVertexWithUV(1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(2),
            ic.getInterpolatedV(13));

    tess.addVertexWithUV(1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(2),
            ic.getInterpolatedV(3));
    tess.addVertexWithUV(TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(3));
    tess.addVertexWithUV(TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU(14),
            ic.getInterpolatedV(3 - 16 * (press - base)));
    tess.addVertexWithUV(1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU(2),
            ic.getInterpolatedV(3 - 16 * (press - base)));

    tess.draw();

    GL11.glCullFace(GL11.GL_BACK);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();

    int items = 0;
    if (tile.getStackInSlot(0) != null) {
        items++;
    }
    if (tile.getStackInSlot(1) != null) {
        items++;
    }
    if (tile.getStackInSlot(2) != null) {
        items++;
    }

    if (relativeProgress > 1.0f || items == 0) {
        ItemStack is = tile.getStackInSlot(3);

        if (is == null) {
            final IInscriberRecipe ir = tile.getTask();
            if (ir != null) {
                is = ir.getOutput().copy();
            }
        }

        this.renderItem(is, 0.0f, block, tile, tess, x, y, z, f, renderer);
    } else {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);

        this.renderItem(tile.getStackInSlot(0), press, block, tile, tess, x, y, z, f, renderer);
        this.renderItem(tile.getStackInSlot(1), -press, block, tile, tess, x, y, z, f, renderer);
        this.renderItem(tile.getStackInSlot(2), 0.0f, block, tile, tess, x, y, z, f, renderer);

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    }
}

From source file:appeng.client.render.blocks.RenderBlockSkyChest.java

License:Open Source License

@Override
public void renderInventory(final BlockSkyChest blk, final ItemStack is, final RenderBlocks renderer,
        final ItemRenderType type, final Object[] obj) {
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    final int metaData = is.getItemDamage();
    final ResourceLocation loc = METADATA_TO_TEXTURE[metaData];

    Minecraft.getMinecraft().getTextureManager().bindTexture(loc);

    GL11.glScalef(1.0F, -1F, -1F);//  w w  w . ja va 2s  . co m
    GL11.glTranslatef(-0.0F, -1.0F, -1.0F);

    this.model.chestLid.offsetY = -(0.9f / 16.0f);
    final float lidAngle = 0.0f;
    this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F);
    this.model.renderAll();

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:appeng.client.render.blocks.RenderBlockSkyChest.java

License:Open Source License

@Override
public void renderTile(final BlockSkyChest block, final TileSkyChest skyChest, final Tessellator tess,
        final double x, final double y, final double z, final float partialTick, final RenderBlocks renderer) {
    if (skyChest == null) {
        return;//from   w  w w  .ja v  a 2s .  com
    }

    if (!skyChest.hasWorldObj()) {
        return;
    }

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    final int metaData = skyChest.getWorldObj().getBlockMetadata(skyChest.xCoord, skyChest.yCoord,
            skyChest.zCoord);
    final ResourceLocation loc = METADATA_TO_TEXTURE[metaData];

    Minecraft.getMinecraft().getTextureManager().bindTexture(loc);

    this.applyTESRRotation(x, y, z, skyChest.getForward(), skyChest.getUp());

    GL11.glScalef(1.0F, -1F, -1F);
    GL11.glTranslatef(-0.0F, -1.0F, -1.0F);

    final long now = System.currentTimeMillis();
    final long distance = now - skyChest.getLastEvent();

    if (skyChest.getPlayerOpen() > 0) {
        skyChest.setLidAngle(skyChest.getLidAngle() + distance * 0.0001f);
    } else {
        skyChest.setLidAngle(skyChest.getLidAngle() - distance * 0.0001f);
    }

    if (skyChest.getLidAngle() > 0.5f) {
        skyChest.setLidAngle(0.5f);
    }

    if (skyChest.getLidAngle() < 0.0f) {
        skyChest.setLidAngle(0.0f);
    }

    float lidAngle = skyChest.getLidAngle();
    lidAngle = 1.0F - lidAngle;
    lidAngle = 1.0F - lidAngle * lidAngle * lidAngle;

    this.model.chestLid.offsetY = -(1.01f / 16.0f);
    this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F);

    // The vanilla chests wants culling reversed...
    GL11.glCullFace(GL11.GL_FRONT);
    this.model.renderAll();
    GL11.glCullFace(GL11.GL_BACK);

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:appeng.client.render.blocks.RenderBlockSkyCompass.java

License:Open Source License

@Override
public void renderInventory(final BlockSkyCompass blk, final ItemStack is, final RenderBlocks renderer,
        ItemRenderType type, final Object[] obj) {
    if (type == ItemRenderType.INVENTORY) {
        boolean isGood = false;

        final IInventory inv = Minecraft.getMinecraft().thePlayer.inventory;
        for (int x = 0; x < inv.getSizeInventory(); x++) {
            if (inv.getStackInSlot(x) == is) {
                isGood = true;/*from ww  w .ja  va2s  .com*/
            }
        }

        if (!isGood) {
            type = ItemRenderType.FIRST_PERSON_MAP;
        }
    }

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    final ResourceLocation loc = new ResourceLocation("appliedenergistics2", "textures/models/compass.png");

    Minecraft.getMinecraft().getTextureManager().bindTexture(loc);

    if (type == ItemRenderType.ENTITY) {
        GL11.glRotatef(-90.0f, 0.0f, 0.0f, 1.0f);
        GL11.glScalef(1.0F, -1F, -1F);
        GL11.glScalef(2.5f, 2.5f, 2.5f);
        GL11.glTranslatef(-0.25F, -1.65F, -0.19F);
    } else {
        if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
            GL11.glRotatef(15.3f, 0.0f, 0.0f, 1.0f);
        }

        GL11.glScalef(1.0F, -1F, -1F);
        GL11.glScalef(2.5f, 2.5f, 2.5f);

        if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
            GL11.glTranslatef(0.3F, -1.65F, -0.19F);
        } else {
            GL11.glTranslatef(0.2F, -1.65F, -0.19F);
        }
    }

    long now = System.currentTimeMillis();
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY
            || type == ItemRenderType.EQUIPPED) {
        EntityPlayer p = Minecraft.getMinecraft().thePlayer;
        float rYaw = p.rotationYaw;

        if (type == ItemRenderType.EQUIPPED) {
            p = (EntityPlayer) obj[1];
            rYaw = p.renderYawOffset;
        }

        final int x = (int) p.posX;
        final int y = (int) p.posY;
        final int z = (int) p.posZ;
        final CompassResult cr = CompassManager.INSTANCE.getCompassDirection(0, x, y, z);

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                CompassManager.INSTANCE.getCompassDirection(0, x + i - 1, y, z + j - 1);
            }
        }

        if (cr.isValidResult()) {
            if (cr.isSpin()) {
                now %= 100000;
                this.model.renderAll((now / 50000.0f) * (float) Math.PI * 500.0f);
            } else {
                if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
                    final float offRads = rYaw / 180.0f * (float) Math.PI;
                    final float adjustment = (float) Math.PI * 0.74f;
                    this.model.renderAll((float) this.flipidiy(cr.getRad() + offRads + adjustment));
                } else {
                    final float offRads = rYaw / 180.0f * (float) Math.PI;
                    final float adjustment = (float) Math.PI * -0.74f;
                    this.model.renderAll((float) this.flipidiy(cr.getRad() + offRads + adjustment));
                }
            }
        } else {
            now %= 1000000;
            this.model.renderAll((now / 500000.0f) * (float) Math.PI * 500.0f);
        }
    } else {
        now %= 100000;
        this.model.renderAll((now / 50000.0f) * (float) Math.PI * 500.0f);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}