Example usage for org.lwjgl.opengl GL11 glCallList

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

Introduction

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

Prototype

public static native void glCallList(@NativeType("GLuint") int list);

Source Link

Document

Executes a display list.

Usage

From source file:micdoodle8.mods.galacticraft.planets.mars.client.SkyProviderMars.java

License:LGPL

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from w  ww.  java  2 s . c  om*/
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f6;

    if (mc.gameSettings.anaglyph) {
        float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f4;
        f2 = f5;
        f3 = f6;
    }

    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks),
            partialTicks);
    float f7;
    float f8;
    float f9;
    float f10;

    float f18 = world.getStarBrightness(partialTicks);

    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starList);
    }

    afloat = new float[4];
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glPushMatrix();
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    afloat[0] = 255 / 255.0F;
    afloat[1] = 194 / 255.0F;
    afloat[2] = 180 / 255.0F;
    afloat[3] = 0.3F;
    f6 = afloat[0];
    f7 = afloat[1];
    f8 = afloat[2];
    float f11;

    if (mc.gameSettings.anaglyph) {
        f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
        f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
        f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
        f6 = f9;
        f7 = f10;
        f8 = f11;
    }

    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3] * 2);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    byte b0 = 16;
    tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);

    // Render sun aura
    f10 = 20.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    tessellator1.startDrawing(GL11.GL_TRIANGLE_FAN);
    tessellator1.setColorRGBA_F(f6, f7, f8, afloat[3]);
    tessellator1.addVertex(0.0D, 100.0D, 0.0D);
    tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);

    // Render larger sun aura
    f10 = 40.0F;
    tessellator1.addVertex(-f10, 100.0D, -f10);
    tessellator1.addVertex(0, 100.0D, (double) -f10 * 1.5F);
    tessellator1.addVertex(f10, 100.0D, -f10);
    tessellator1.addVertex((double) f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(f10, 100.0D, f10);
    tessellator1.addVertex(0, 100.0D, (double) f10 * 1.5F);
    tessellator1.addVertex(-f10, 100.0D, f10);
    tessellator1.addVertex((double) -f10 * 1.5F, 100.0D, 0);
    tessellator1.addVertex(-f10, 100.0D, -f10);

    tessellator1.draw();
    GL11.glPopMatrix();
    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glPushMatrix();
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    // Render sun
    f10 = 14.0F;
    mc.renderEngine.bindTexture(SkyProviderMars.sunTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, 100.0D, -f10, 0.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, -f10, 1.0D, 0.0D);
    tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV(-f10, 100.0D, f10, 0.0D, 1.0D);
    tessellator1.draw();

    // Render earth
    f10 = 0.5F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(40.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyProviderMars.overworldTexture);
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV(-f10, -100.0D, f10, 0, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, f10, 1, 1);
    tessellator1.addVertexWithUV(f10, -100.0D, -f10, 1, 0);
    tessellator1.addVertexWithUV(-f10, -100.0D, -f10, 0, 0);
    tessellator1.draw();

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f9, f8);
        tessellator1.addVertex(f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, -f8);
        tessellator1.addVertex(-f8, f9, f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, -f8);
        tessellator1.addVertex(-f8, f10, f8);
        tessellator1.addVertex(f8, f10, f8);
        tessellator1.addVertex(f8, f10, -f8);
        tessellator1.draw();
    }

    if (world.provider.isSkyColored()) {
        GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:minecraft.phoenix.cityscape.space.util.SkyRendererUtil.java

License:LGPL

@Override
@SideOnly(Side.CLIENT)//w  ww.ja  v  a  2  s  . co  m
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    if (!once) {
        this.starGLCallList = GLAllocation.generateDisplayLists(3);
        GL11.glPushMatrix();
        GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
        SkyRendererUtil.renderStars().draw();
        GL11.glEndList();
        GL11.glPopMatrix();
        Tessellator var5 = Tessellator.instance;
        this.glSkyList = this.starGLCallList + 1;
        GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
        byte var7 = 64;
        int var8 = 256 / var7 + 2;
        float var6 = 16.0F;
        int var9;
        int var10;
        for (var9 = -var7 * var8; var9 <= var7 * var8; var9 += var7) {
            for (var10 = -var7 * var8; var10 <= var7 * var8; var10 += var7) {
                var5.startDrawingQuads();
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + var7));
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + var7));
                var5.draw();
            }
        }
        GL11.glEndList();
        this.glSkyList2 = this.starGLCallList + 2;
        GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
        var6 = -16.0F;
        var5.startDrawingQuads();
        for (var9 = -var7 * var8; var9 <= var7 * var8; var9 += var7) {
            for (var10 = -var7 * var8; var10 <= var7 * var8; var10 += var7) {
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + 0));
                var5.addVertex((double) (var9 + 0), (double) var6, (double) (var10 + var7));
                var5.addVertex((double) (var9 + var7), (double) var6, (double) (var10 + var7));
            }
        }
        var5.draw();
        GL11.glEndList();
    }
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float var3 = 0.0F;
    float var4 = 0.0F;
    float var5 = 0.0F;
    GL11.glColor3f(var3, var4, var5);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(var3, var4, var5);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    float var9 = 0.0F;
    float var10 = 0.0F;
    float var11 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef(var9, var10, var11);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float var20 = world.getStarBrightness(partialTicks);
    GL11.glColor4f(var20, var20, var20, var20);
    GL11.glCallList(this.starGLCallList);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 100.0F, 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:model.Voxel.java

@Override
public void render() {
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glCallList(kind.displayList);
    GL11.glEnd();
}

From source file:mods.railcraft.client.render.carts.CartContentRendererTank.java

License:Open Source License

private void renderTank(RenderCart renderer, EntityMinecart cart, float light, float time, int x, int y,
        int z) {/*from  ww w .ja v a2  s. c  om*/
    EntityCartTank cartTank = (EntityCartTank) cart;
    StandardTank tank = cartTank.getTankManager().get(0);
    if (tank.renderData.fluid != null && tank.renderData.amount > 0) {
        int[] displayLists = FluidRenderer.getLiquidDisplayLists(tank.renderData.fluid);
        if (displayLists != null) {
            GL11.glPushMatrix();

            GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

            GL11.glTranslatef(0, 0.0625f, 0);

            float cap = tank.getCapacity();
            float level = Math.min(tank.renderData.amount, cap) / cap;

            renderer.bindTex(FluidRenderer.getFluidSheet(tank.renderData.fluid));
            FluidRenderer.setColorForTank(tank);
            GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]);

            if (cartTank.isFilling()) {
                ResourceLocation texSheet = FluidRenderer.setupFlowingLiquidTexture(tank.renderData.fluid,
                        fillBlock.texture);
                if (texSheet != null) {
                    renderer.bindTex(texSheet);
                    RenderFakeBlock.renderBlockForEntity(fillBlock, cart.worldObj, x, y, z, false, true);
                }
            }

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

From source file:mods.railcraft.client.render.RenderFluidLoader.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
    TileLoaderFluidBase base = (TileLoaderFluidBase) tile;
    GL11.glPushMatrix();// ww  w .  j  a va 2 s  .co  m
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    //        GL11.glEnable(GL11.GL_CULL_FACE);

    backDrop.texture[0] = base.getMachineType().getTexture(7);
    bindTexture(TextureMap.locationBlocksTexture);
    RenderFakeBlock.renderBlock(backDrop, base.getWorld(), x, y, z, false, true);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GL11.glScalef(1f, 0.6f, 1f);

    StandardTank tank = base.getTankManager().get(0);

    if (tank.renderData.fluid != null && tank.renderData.amount > 0) {
        int[] displayLists = FluidRenderer.getLiquidDisplayLists(tank.renderData.fluid);
        if (displayLists != null) {
            GL11.glPushMatrix();

            if (FluidRenderer.getFluidTexture(tank.renderData.fluid, false) != null) {

                float cap = tank.getCapacity();
                float level = (float) Math.min(tank.renderData.amount, cap) / cap;

                bindTexture(FluidRenderer.getFluidSheet(tank.renderData.fluid));
                FluidRenderer.setColorForTank(tank);
                GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]);
            }

            GL11.glPopMatrix();
        }
    }

    //        GL11.glScalef(0.994f, 1.05f, 0.994f);
    GL11.glPopAttrib();
    GL11.glPopMatrix();

    if (tile.getClass() == TileFluidLoader.class) {
        TileFluidLoader loader = (TileFluidLoader) tile;

        pipe.minY = RenderTools.PIXEL - loader.getPipeLenght();

        RenderFakeBlock.renderBlock(pipe, loader.getWorld(), x, y, z, false, true);
    }
}

From source file:mods.railcraft.client.render.RenderIronTank.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
    if (!((TileMultiBlock) tile).isStructureValid())
        return;/*from ww  w  .  j ava  2 s .co  m*/

    if (tile instanceof TileTankIronValve) {
        TileTankIronValve valve = (TileTankIronValve) tile;
        StandardTank fillTank = valve.getFillTank();
        if (fillTank.renderData.fluid != null && fillTank.renderData.amount > 0) {
            GL11.glPushMatrix();
            if (valve.getPattern().getPatternMarkerChecked(valve.getPatternPositionX(),
                    valve.getPatternPositionY() - 1, valve.getPatternPositionZ()) == 'A') {

                prepFillTexture(fillTank);

                int height = getTankHeight(valve);
                float yOffset = height / 2f;
                float vScale = height - 2f;
                GL11.glTranslatef((float) x + 0.5F, (float) y + yOffset - height + 1, (float) z + 0.5F);
                GL11.glScalef(1f, vScale, 1f);

                draw(fillTank);
            } else if (valve.getPattern().getPatternMarkerChecked(valve.getPatternPositionX() - 1,
                    valve.getPatternPositionY(), valve.getPatternPositionZ()) == 'A') {

                prepFillTexture(fillTank);

                float vScale = getVerticalScaleSide(valve);
                float yOffset = 0.5f - vScale / 2f + RenderTools.PIXEL * 3;
                GL11.glTranslatef((float) x - 0.5F + RenderTools.PIXEL * 5, (float) y + yOffset,
                        (float) z + 0.5F);
                GL11.glScalef(1f, vScale, 1f);

                draw(fillTank);
            } else if (valve.getPattern().getPatternMarkerChecked(valve.getPatternPositionX() + 1,
                    valve.getPatternPositionY(), valve.getPatternPositionZ()) == 'A') {

                prepFillTexture(fillTank);

                float vScale = getVerticalScaleSide(valve);
                float yOffset = 0.5f - vScale / 2f + RenderTools.PIXEL * 3;
                GL11.glTranslatef((float) x + 1.5F - RenderTools.PIXEL * 5, (float) y + yOffset,
                        (float) z + 0.5F);
                GL11.glScalef(1f, vScale, 1f);

                draw(fillTank);
            } else if (valve.getPattern().getPatternMarkerChecked(valve.getPatternPositionX(),
                    valve.getPatternPositionY(), valve.getPatternPositionZ() - 1) == 'A') {

                prepFillTexture(fillTank);

                float vScale = getVerticalScaleSide(valve);
                float yOffset = 0.5f - vScale / 2f + RenderTools.PIXEL * 3;
                GL11.glTranslatef((float) x + 0.5F, (float) y + yOffset,
                        (float) z - 0.5F + RenderTools.PIXEL * 5);
                GL11.glScalef(1f, vScale, 1f);

                draw(fillTank);
            } else if (valve.getPattern().getPatternMarkerChecked(valve.getPatternPositionX(),
                    valve.getPatternPositionY(), valve.getPatternPositionZ() + 1) == 'A') {

                prepFillTexture(fillTank);

                float vScale = getVerticalScaleSide(valve);
                float yOffset = 0.5f - vScale / 2f + RenderTools.PIXEL * 3;
                GL11.glTranslatef((float) x + 0.5F, (float) y + yOffset,
                        (float) z + 1.5F - RenderTools.PIXEL * 5);
                GL11.glScalef(1f, vScale, 1f);

                draw(fillTank);
            }
            GL11.glPopMatrix();
        }
    }

    TileTankBase ironTank = (TileTankBase) tile;
    if (!ironTank.isMaster() || ironTank.isInvalid())
        return;
    int height = getTankHeight(ironTank);
    float yOffset = height / 2f;
    float vScale = height - 2;
    float hScale = ironTank.getPattern().getPatternWidthX() - 2;

    TankManager tankManager = ironTank.getTankManager();
    if (tankManager == null)
        return;
    StandardTank tank = tankManager.get(0);
    if (tank == null)
        return;

    if (tank.renderData.fluid != null && tank.renderData.amount > 0) {
        preGL();
        GL11.glTranslatef((float) x + 0.5F, (float) y + yOffset + 0.01f, (float) z + 0.5F);
        GL11.glScalef(hScale, vScale, hScale);

        //        GL11.glScalef(0.999f, 1, 0.999f);
        int[] displayLists = FluidRenderer.getLiquidDisplayLists(tank.renderData.fluid);
        if (displayLists != null) {
            GL11.glPushMatrix();

            float cap = tank.getCapacity();
            float level = (float) Math.min(tank.renderData.amount, cap) / cap;

            bindTexture(FluidRenderer.getFluidSheet(tank.renderData.fluid));
            FluidRenderer.setColorForTank(tank);
            GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]);

            GL11.glPopMatrix();
        }

        postGL();
    }
}

From source file:mods.railcraft.client.render.RenderLiquidLoader.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
    TileLoaderLiquidBase base = (TileLoaderLiquidBase) tile;
    GL11.glPushMatrix();/*from w w w .  j av  a 2s .  c  om*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    //        GL11.glEnable(GL11.GL_CULL_FACE);

    backDrop.texture[0] = base.getMachineType().getTexture(7);
    bindTexture(TextureMap.locationBlocksTexture);
    RenderFakeBlock.renderBlock(backDrop, base.getWorld(), x, y, z, false, true);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GL11.glScalef(1f, 0.6f, 1f);

    IFluidTank tank = base.getTankManager().get(0);

    FluidStack fluidStack = tank.getFluid();
    if (fluidStack != null && fluidStack.amount > 0) {
        int[] displayLists = FluidRenderer.getLiquidDisplayLists(fluidStack);
        if (displayLists != null) {
            GL11.glPushMatrix();

            if (FluidRenderer.getFluidTexture(fluidStack, false) != null) {

                float cap = tank.getCapacity();
                float level = (float) Math.min(fluidStack.amount, cap) / cap;

                bindTexture(FluidRenderer.getFluidSheet(fluidStack));
                FluidRenderer.setColorForFluidStack(fluidStack);
                GL11.glCallList(displayLists[(int) (level * (float) (FluidRenderer.DISPLAY_STAGES - 1))]);
            }

            GL11.glPopMatrix();
        }
    }

    //        GL11.glScalef(0.994f, 1.05f, 0.994f);
    GL11.glPopAttrib();
    GL11.glPopMatrix();

    if (tile.getClass() == TileLiquidLoader.class) {
        TileLiquidLoader loader = (TileLiquidLoader) tile;

        pipe.minY = RenderTools.PIXEL - loader.getPipeLenght();

        RenderFakeBlock.renderBlock(pipe, loader.getWorld(), x, y, z, false, true);
    }
}

From source file:net.kubin.world.Sky.java

License:Apache License

private void drawShpere(float x, float y, float z) {
    GL11.glPushMatrix();//from  w w w.j a  v a2s  .c  o m
    GL11.glTranslatef(x, y, z);
    GL11.glColor3f(_color.x(), _color.y(), _color.z());

    if (_sphereCallList == 0) {
        _sphereCallList = GL11.glGenLists(1);
        GL11.glNewList(_sphereCallList, GL11.GL_COMPILE_AND_EXECUTE);
        GL11.glBegin(GL11.GL_TRIANGLE_FAN);
        GL11.glVertex3f(0, 0, 0);

        for (int i = 0; i <= _vertices; ++i) {
            float angle = MathHelper.f_2PI / _vertices * i;
            float xx = MathHelper.cos(angle) * _radius;
            float zz = MathHelper.sin(angle) * _radius;
            GL11.glVertex3f(xx, -_bend, zz);
        }

        GL11.glEnd();
        GL11.glEndList();
    } else {
        GL11.glCallList(_sphereCallList);
    }

    GL11.glPopMatrix();
}

From source file:net.kubin.world.Sky.java

License:Apache License

private void drawClouds(float x, float y, float z) {
    GL11.glPushMatrix();//from   www.  java 2 s.c  o m
    GL11.glTranslatef(x, y, z);

    if (_cloudsCallList == 0) {
        _cloudsCallList = GL11.glGenLists(1);
        GL11.glNewList(_cloudsCallList, GL11.GL_COMPILE_AND_EXECUTE);
        float hw = _cloudsTexWidth / 2.0f;
        float hh = _cloudsTexHeight / 2.0f;

        hw *= _cloudsScale;
        hh *= _cloudsScale;

        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(-hw, 0, -hh);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(+hw, 0, -hh);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(+hw, 0, +hh);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(-hw, 0, +hh);

        GL11.glEnd();

        GL11.glEndList();
    } else {
        GL11.glCallList(_cloudsCallList);
    }

    GL11.glPopMatrix();
}

From source file:net.kubin.world.World.java

License:Apache License

private void renderOverlay() {
    Configuration conf = Kubin.getConfiguration();

    Game.getInstance().initOverlayRendering();

    GL11.glColor3f(1, 1, 1);//from   w ww. java 2s .c  o m

    if (Game.RENDER_INFORMATION_OVERLAY) {
        GLFont infoFont = FontStorage.getFont("Monospaced_20");

        /* Down Left Info */
        infoFont.print(4, 30, _player.coordinatesToString());
        infoFont.print(4, 45, "Visible Chunks:      " + _visibleChunks.size());
        infoFont.print(4, 60, "Updading Blocks:     " + _updatingBlocks);
        infoFont.print(4, 75, "Total Chunks in RAM: " + _chunkManager.getTotalChunkCount());
        infoFont.print(4, 90, "Local Chunks:        " + _localChunks.size());
        infoFont.print(4, 105, "Total Local Blocks:  " + _localBlockCount);
        infoFont.print(4, 120, "Time:  " + _time);
        infoFont.print(4, 135, "Sunlight:  " + _sunlight);

    }

    /** RENDER **/
    if (_activatedInventory != null) {
        Game.getInstance().renderTransculentOverlayLayer();
        _activatedInventory.renderInventory();
    } else {
        int width = conf.getWidth();
        int height = conf.getHeight();
        // Center Cross
        GL11.glDisable(GL11.GL_TEXTURE_2D);

        if (CENTER_CROSS_CALL_LIST == 0) {
            CENTER_CROSS_CALL_LIST = GL11.glGenLists(1);
            GL11.glNewList(CENTER_CROSS_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE);

            int crossSize = 7;
            int crossHole = 4;

            GL11.glLineWidth(2.5f);

            GL11.glColor3f(255, 255, 255);
            GL11.glBegin(GL11.GL_LINES);
            GL11.glVertex3f(width / 2f - crossSize - crossHole, height / 2f, 0);
            GL11.glVertex3f(width / 2f - crossHole, height / 2f, 0);

            GL11.glVertex3f(width / 2f + crossSize + crossHole, height / 2f, 0);
            GL11.glVertex3f(width / 2f + crossHole, height / 2f, 0);

            GL11.glVertex3f(width / 2f, height / 2f - crossSize - crossHole, 0);
            GL11.glVertex3f(width / 2f, height / 2f - crossHole, 0);

            GL11.glVertex3f(width / 2f, height / 2f + crossSize + crossHole, 0);
            GL11.glVertex3f(width / 2f, height / 2f + crossHole, 0);

            GL11.glEnd();
            GL11.glEndList();
        } else {
            GL11.glCallList(CENTER_CROSS_CALL_LIST);
        }

        GL11.glEnable(GL11.GL_TEXTURE_2D);

        // Inventory bar
        GL11.glPushMatrix();
        Texture texGui = TextureStorage.getTexture("gui.gui");
        texGui.bind();
        float tileSize = 20.0f / texGui.getImageWidth();

        if (INVENTORY_BAR_CALL_LIST == 0) {
            INVENTORY_BAR_CALL_LIST = GL11.glGenLists(2);

            /* Bar */
            GL11.glNewList(INVENTORY_BAR_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE);

            GL11.glTranslatef(width / 2.0f - 9 * 20, 0, 0);
            GL11.glColor3f(1.0f, 1.0f, 1.0f);
            GL11.glBegin(GL11.GL_QUADS);

            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(0, 40);

            GL11.glTexCoord2f(tileSize * 9, 0);
            GL11.glVertex2f(9 * 40, 40);

            GL11.glTexCoord2f(tileSize * 9, tileSize);
            GL11.glVertex2f(9 * 40, 0);

            GL11.glTexCoord2f(0, tileSize);
            GL11.glVertex2f(0, 0);

            GL11.glEnd();
            GL11.glEndList();

            /* Little frame around selected item */
            float frameTileSize = 24.0f / texGui.getImageWidth();
            float frameTileY = 22.0f / texGui.getImageHeight();

            GL11.glNewList(INVENTORY_BAR_CALL_LIST + 1, GL11.GL_COMPILE);
            GL11.glBegin(GL11.GL_QUADS);

            GL11.glTexCoord2f(0, frameTileY);
            GL11.glVertex2f(0, 48);

            GL11.glTexCoord2f(frameTileSize, frameTileY);
            GL11.glVertex2f(48, 48);

            GL11.glTexCoord2f(frameTileSize, frameTileY + frameTileSize);
            GL11.glVertex2f(48, 0);

            GL11.glTexCoord2f(0, frameTileY + frameTileSize);
            GL11.glVertex2f(0, 0);

            GL11.glEnd();
            GL11.glEndList();
        } else {
            GL11.glCallList(INVENTORY_BAR_CALL_LIST);
        }

        /* Content */
        GL11.glPushMatrix();
        GL11.glTranslatef(20, 20, 0);

        for (int i = 0; i < 9; ++i) {
            InventoryPlace place = getActivePlayer().getInventory().getInventoryPlace(i);

            if (place != null) {
                place.render();
            }

            GL11.glTranslatef(40, 0, 0);
        }

        texGui.bind();
        GL11.glPopMatrix();
        GL11.glTranslatef(getActivePlayer().getSelectedInventoryItemIndex() * 40.0f - 4, -4, 0);
        GL11.glCallList(INVENTORY_BAR_CALL_LIST + 1);

        GL11.glPopMatrix();
    }
}