Example usage for org.lwjgl.opengl GL11 GL_COMPILE

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

Introduction

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

Prototype

int GL_COMPILE

To view the source code for org.lwjgl.opengl GL11 GL_COMPILE.

Click Source Link

Document

ListMode

Usage

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

License:Apache License

@Override
public void create() {
    _callList = GL11.glGenLists(1);// ww w .ja  v a2  s .  c  om

    GL11.glNewList(_callList, GL11.GL_COMPILE);
    GL11.glBegin(GL11.GL_QUADS);

    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.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  a  va 2s .  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 void startList(int list) {
    GL11.glNewList(list, GL11.GL_COMPILE);
}

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 w w .ja  v  a 2  s. com

    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);//from  w  w  w . j ava 2  s. c o m
        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
protected void doFlush() {
    GL11.glNewList(displayList, GL11.GL_COMPILE);
    FloatBuffer vBuffer = BufferUtils.createFloatBuffer(vertexBuffer.size());

    vBuffer.clear();// w  ww  .  j  av  a2s .  co m
    vBuffer.put(vertexBuffer.toArray());
    vBuffer.flip();

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glVertexPointer(4, 0, vBuffer);

    /*if (useColors) {
       vBuffer.clear();
       vBuffer.put(colorBuffer.toArray());
       vBuffer.flip();
               
       GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
       GL11.glColorPointer(4, 0, vBuffer);
    }*/

    if (useNormals) {
        vBuffer.clear();
        vBuffer.put(normalBuffer.toArray());
        vBuffer.flip();

        GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
        GL11.glNormalPointer(0, vBuffer);
    }

    if (useTextures) {
        FloatBuffer temp = BufferUtils.createFloatBuffer(uvBuffer.size());
        temp.put(uvBuffer.toArray());
        temp.flip();

        GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
        GL11.glTexCoordPointer(2, 0, temp);
    }

    GL11.glDrawArrays(renderMode, 0, numVertices);

    GL11.glEndList();
}

From source file:org.terasology.componentSystem.BlockParticleEmitterSystem.java

License:Apache License

protected void renderParticle(Particle particle, byte blockType, float temperature, float humidity,
        float light) {
    int displayList = displayLists.get(BlockManager.getInstance().getBlock(blockType).getBlockFamily());
    if (displayList == 0) {
        displayList = glGenLists(1);/*from ww w  . j a  va2 s  .  c  o  m*/
        glNewList(displayList, GL11.GL_COMPILE);
        drawParticle(blockType);
        glEndList();
        displayLists.put(BlockManager.getInstance().getBlock(blockType).getBlockFamily(), displayList);
    }

    ShaderProgram shader = ShaderManager.getInstance().getShaderProgram("particle");

    Vector4f color = BlockManager.getInstance().getBlock(blockType).calcColorOffsetFor(BlockPart.FRONT,
            temperature, humidity);
    shader.setFloat3("colorOffset", color.x, color.y, color.z);
    shader.setFloat("texOffsetX", particle.texOffset.x);
    shader.setFloat("texOffsetY", particle.texOffset.y);
    shader.setFloat("light", light);

    glCallList(displayList);
}

From source file:org.terasology.logic.manager.DefaultRenderingProcess.java

License:Apache License

private void renderQuad() {
    if (displayListQuad == -1) {
        displayListQuad = glGenLists(1);

        glNewList(displayListQuad, GL11.GL_COMPILE);

        glBegin(GL_QUADS);// w  w w .  ja v a  2 s  .  co  m
        glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

        glTexCoord2d(0.0, 0.0);
        glVertex3i(-1, -1, -1);

        glTexCoord2d(1.0, 0.0);
        glVertex3i(1, -1, -1);

        glTexCoord2d(1.0, 1.0);
        glVertex3i(1, 1, -1);

        glTexCoord2d(0.0, 1.0);
        glVertex3i(-1, 1, -1);

        glEnd();

        glEndList();
    }

    glCallList(displayListQuad);
}

From source file:org.terasology.logic.manager.PostProcessingRenderer.java

License:Apache License

private void renderQuad() {
    if (_displayListQuad == -1) {
        _displayListQuad = glGenLists(1);

        glNewList(_displayListQuad, GL11.GL_COMPILE);

        glBegin(GL_QUADS);/*from   ww  w .j  a  v  a 2s. c o  m*/
        glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

        glTexCoord2d(0.0, 0.0);
        glVertex3i(-1, -1, -1);

        glTexCoord2d(1.0, 0.0);
        glVertex3i(1, -1, -1);

        glTexCoord2d(1.0, 1.0);
        glVertex3i(1, 1, -1);

        glTexCoord2d(0.0, 1.0);
        glVertex3i(-1, 1, -1);

        glEnd();

        glEndList();
    }

    glCallList(_displayListQuad);
}

From source file:org.terasology.logic.particles.BlockParticleEmitterSystem.java

License:Apache License

public void initialise() {
    if (displayList == 0) {
        displayList = glGenLists(1);/*  www .j a  v a2 s.co m*/
        glNewList(displayList, GL11.GL_COMPILE);
        drawParticle();
        glEndList();
    }
    sorter.initialise(worldRenderer.getActiveCamera());
}