Example usage for org.lwjgl.opengl GL11 glGenLists

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

Introduction

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

Prototype

@NativeType("GLuint")
public static native int glGenLists(@NativeType("GLsizei") int s);

Source Link

Document

Returns an integer n such that the indices n,..., n + s - 1 are previously unused (i.e.

Usage

From source file:org.craftmania.blocks.CrossedBlockBrush.java

License:Apache License

@Override
public void create() {
    _callList = GL11.glGenLists(1);

    GL11.glNewList(_callList, GL11.GL_COMPILE);
    GL11.glBegin(GL11.GL_QUADS);//from   ww w  .jav  a2 s .c  om

    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y());
    GL11.glVertex3f(-0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y());
    GL11.glVertex3f(0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(-0.5f, -0.5f, -0.5f);

    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y());
    GL11.glVertex3f(0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y());
    GL11.glVertex3f(-0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(-0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(0.5f, -0.5f, -0.5f);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.craftmania.world.Sky.java

License:Apache License

private void drawShpere(float x, float y, float z) {
    GL11.glPushMatrix();//from   ww  w  .j  a  v  a 2 s  . c om
    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   w  w w.ja va 2 s . c  om*/
    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);/*from   w  w  w  .j av  a2 s.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 (_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 int genLists(int range) {
    return GL11.glGenLists(range);
}

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);
        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);
        }/*from  w ww . ja  v a2s .  c  o m*/
        GL11.glEnd();
        GL11.glEndList();
    }
    GL11.glCallList(listnum);
}

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

License:Open Source License

public GL11BatchVertexRenderer(int mode) {
    super(mode);
    displayList = GL11.glGenLists(1);
}

From source file:pso.Surface.java

License:Open Source License

public static void assemble(float[][] val, float minc, float maxc, int rezx, int rezy) {
    int i, j;/* w ww  .ja  v a 2s . c o m*/
    float px, py;
    float tmp;

    Color col;

    float spx = -rezx / 2;
    float spy = -rezy / 2;

    handle = GL11.glGenLists(1);
    GL11.glNewList(handle, GL11.GL_COMPILE);

    GL11.glBegin(GL11.GL_QUADS);

    px = spx;
    for (i = 0; i < rezx - 1; i++) {
        py = spy;
        for (j = 0; j < rezy - 1; j++) {
            tmp = (float) (1 - ((val[i][j] - minc) / (maxc - minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex2f(px, py);

            tmp = (float) (1 - ((val[i][j + 1] - minc) / (maxc - minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex2f(px, py + 1);

            tmp = (float) (1 - ((val[i + 1][j + 1] - minc) / (maxc - minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex2f(px + 1, py + 1);

            tmp = (float) (1 - ((val[i + 1][j] - minc) / (maxc - minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex2f(px + 1, py);

            py += 1;
        }
        px += 1;
    }

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

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);
        }/*from ww  w.j  av a2  s  .c om*/

        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);
}