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:org.craftmania.world.Sky.java

License:Apache License

private void drawShpere(float x, float y, float z) {
    GL11.glPushMatrix();//from  w  w w.  j  a  va2 s  . co 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:org.craftmania.world.Sky.java

License:Apache License

private void drawClouds(float x, float y, float z) {
    GL11.glPushMatrix();/*from ww  w.j  a  v  a  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:org.craftmania.world.World.java

License:Apache License

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

    Game.getInstance().initOverlayRendering();

    GL11.glColor3f(1, 1, 1);//  ww w.  j a v a  2  s. co  m

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

        /* Down Left Info */
        infoFont.print(4, 4, "CraftMania");
        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 = 10;
            int crossHole = 5;

            GL11.glLineWidth(2.5f);

            GL11.glColor3f(0, 0, 0);
            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, 10, 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();
    }
}

From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void callList(int list) {
    GL11.glCallList(list);
}

From source file:org.minetweak.world.World.java

License:Apache License

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

    Game.getInstance().initOverlayRendering();

    GL11.glColor3f(1, 1, 1);/*w ww.j a v a2s  .c  o  m*/

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

        /* Down Left Info */
        infoFont.print(4, 4, "CraftMania");
        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 (currentGui != null) {
        Game.getInstance().renderTransculentOverlayLayer();
        currentGui.render();
    } 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 = 10;
            int crossHole = 5;

            GL11.glLineWidth(2.5f);

            GL11.glColor3f(0, 0, 0);
            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, 10, 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) {
            Inventory.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();
    }
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

private void drawSphere() {
    // icosahedron data for an icosahedron of radius 1.0
    //      # define ICX 0.525731112119133606f
    //      # define ICZ 0.850650808352039932f
    if (listnum == 0) {
        listnum = GL11.glGenLists(1);//w  w w .  ja va  2  s.  c  om
        GL11.glNewList(listnum, GL11.GL_COMPILE);
        GL11.glBegin(GL11.GL_TRIANGLES);
        for (int i = 0; i < 20; i++) {
            //            drawPatch (&idata[index[i][2]][0],&idata[index[i][1]][0],
            //                  &idata[index[i][0]][0],sphere_quality);
            drawPatch(idata[index[i][2]], idata[index[i][1]], idata[index[i][0]], sphere_quality);
        }
        GL11.glEnd();
        GL11.glEndList();
    }
    GL11.glCallList(listnum);
}

From source file:org.spout.engine.renderer.GL11BatchVertexRenderer.java

License:Open Source License

@Override
public void doRender(RenderMaterial material, int startVert, int endVert) {
    material.assign();
    GL11.glCallList(displayList);
}

From source file:org.yogpstop.qp.client.RenderRefinery.java

License:Open Source License

private void render(TileRefinery tile, double x, double y, double z) {
    FluidStack liquid1 = null, liquid2 = null, liquidResult = null;

    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = this.magnet[0];
    if (tile != null) {
        liquid1 = tile.src1;//from   w ww .  j ava2  s. c  o m
        liquid2 = tile.src2;
        liquidResult = tile.res;

        anim = tile.getAnimationStage();

        angle = 0;
        switch (tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) {
        case 2:
            angle = 90;
            break;
        case 3:
            angle = 270;
            break;
        case 4:
            angle = 180;
            break;
        case 5:
            angle = 0;
            break;
        }

        if (tile.animationSpeed <= 1) {
            theMagnet = this.magnet[0];
        } else if (tile.animationSpeed <= 2.5) {
            theMagnet = this.magnet[1];
        } else if (tile.animationSpeed <= 4.5) {
            theMagnet = this.magnet[2];
        } else {
            theMagnet = this.magnet[3];
        }
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GL11.glScalef(0.99F, 0.99F, 0.99F);

    GL11.glRotatef(angle, 0, 1, 0);

    bindTexture(TEXTURE);

    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glTranslatef(-4F * pixel, 0, -4F * pixel);
    this.tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, 4F * pixel);

    GL11.glTranslatef(-4F * pixel, 0, 4F * pixel);
    this.tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, -4F * pixel);

    GL11.glTranslatef(4F * pixel, 0, 0);
    this.tank.render(pixel);
    GL11.glTranslatef(-4F * pixel, 0, 0);
    GL11.glPopMatrix();

    float trans1, trans2;

    if (anim <= 100) {
        trans1 = 12F * pixel * anim / 100F;
        trans2 = 0;
    } else if (anim <= 200) {
        trans1 = 12F * pixel - (12F * pixel * (anim - 100F) / 100F);
        trans2 = 12F * pixel * (anim - 100F) / 100F;
    } else {
        trans1 = 12F * pixel * (anim - 200F) / 100F;
        trans2 = 12F * pixel - (12F * pixel * (anim - 200F) / 100F);
    }

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    if (tile != null) {
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        GL11.glScalef(0.5F, 1, 0.5F);

        if (liquid1 != null && liquid1.amount > 0) {
            int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.worldObj, false);

            if (list1 != null) {
                bindTexture(FluidRenderer.getFluidSheet(liquid1));
                FluidRenderer.setColorForFluidStack(liquid1);
                GL11.glCallList(
                        list1[(int) (liquid1.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]);
            }
        }

        if (liquid2 != null && liquid2.amount > 0) {
            int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.worldObj, false);

            if (list2 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(0, 0, 1);
                bindTexture(FluidRenderer.getFluidSheet(liquid2));
                FluidRenderer.setColorForFluidStack(liquid2);
                GL11.glCallList(
                        list2[(int) (liquid2.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]);
                GL11.glPopMatrix();
            }
        }

        if (liquidResult != null && liquidResult.amount > 0) {
            int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.worldObj, false);

            if (list3 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(1, 0, 0.5F);
                bindTexture(FluidRenderer.getFluidSheet(liquidResult));
                FluidRenderer.setColorForFluidStack(liquidResult);
                GL11.glCallList(list3[(int) (liquidResult.amount / (float) tile.buf
                        * (FluidRenderer.DISPLAY_STAGES - 1))]);
                GL11.glPopMatrix();
            }
        }
        GL11.glPopAttrib();
    }

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

From source file:RediscoveredMod.MD3Renderer.java

License:Open Source License

public final void render(int var1, int var2, float var3) {
    if ((this.displayList == 0) || (this.useAnimation)) {
        if (!this.useAnimation) {
            this.displayList = GL11.glGenLists(1);
        }/*w ww .  j ava  2  s  .  co m*/

        GL11.glEnableClientState(32884);
        GL11.glEnableClientState(32888);
        GL11.glEnableClientState(32885);
        if (!this.useAnimation) {
            GL11.glNewList(this.displayList, 4864);
        }

        for (int i = 0; i < this.model.surfaces.length; i++) {
            MD3Surface surface = this.model.surfaces[i];
            if (this.useAnimation)
                surface.setFrame(var1, var2, var3);
            else {
                surface.setFrame(0, 0, 0.0F);
            }

            surface.triangles.position(0);

            surface.d.position(0);
            GL11.glVertexPointer(3, 0, surface.vertices);
            GL11.glNormalPointer(0, surface.normals);
            GL11.glTexCoordPointer(2, 0, surface.d);
            GL11.glDrawElements(4, surface.triangles);
        }

        if (!this.useAnimation) {
            GL11.glEndList();
        }
        GL11.glDisableClientState(32884);
        GL11.glDisableClientState(32888);
        GL11.glDisableClientState(32885);
    }

    if (!this.useAnimation)
        GL11.glCallList(this.displayList);
}

From source file:rheel.ac.client.renderer.model.ModelSAPC.java

License:Open Source License

public void render(float f) {
    GL11.glScalef(f, f, f);
    GL11.glCallList(this.renderID);
    GL11.glScalef(1 / f, 1 / f, 1 / f);
}