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:micdoodle8.mods.galacticraft.planets.mars.client.SkyProviderMars.java

License:LGPL

public SkyProviderMars() {
    int displayLists = GLAllocation.generateDisplayLists(3);
    this.starList = displayLists;
    this.glSkyList = displayLists + 1;
    this.glSkyList2 = displayLists + 2;

    // Bind stars to display list
    GL11.glPushMatrix();/* w  w w  . j a  v  a2 s. c o  m*/
    GL11.glNewList(this.starList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();

    final Tessellator tessellator = Tessellator.instance;
    GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
    final byte byte2 = 64;
    final int i = 256 / byte2 + 2;
    float f = 16F;

    for (int j = -byte2 * i; j <= byte2 * i; j += byte2) {
        for (int l = -byte2 * i; l <= byte2 * i; l += byte2) {
            tessellator.startDrawingQuads();
            tessellator.addVertex(j + 0, f, l + 0);
            tessellator.addVertex(j + byte2, f, l + 0);
            tessellator.addVertex(j + byte2, f, l + byte2);
            tessellator.addVertex(j + 0, f, l + byte2);
            tessellator.draw();
        }
    }

    GL11.glEndList();
    GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
    f = -16F;
    tessellator.startDrawingQuads();

    for (int k = -byte2 * i; k <= byte2 * i; k += byte2) {
        for (int i1 = -byte2 * i; i1 <= byte2 * i; i1 += byte2) {
            tessellator.addVertex(k + byte2, f, i1 + 0);
            tessellator.addVertex(k + 0, f, i1 + 0);
            tessellator.addVertex(k + 0, f, i1 + byte2);
            tessellator.addVertex(k + byte2, f, i1 + byte2);
        }
    }

    tessellator.draw();
    GL11.glEndList();
}

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

License:LGPL

@Override
@SideOnly(Side.CLIENT)/*  w  w  w  .j av  a2 s .  c  o 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:net.kubin.rendering.GLFont.java

License:Apache License

/**
 * Build the character set display list from the given texture. Creates one
 * quad for each character, with one letter textured onto each quad. Assumes
 * the texture is a 256x256 image containing every character of the charset
 * arranged in a 16x16 grid. Each character is 16x16 pixels. Call
 * destroyFont() to release the display list memory.
 *
 * Should be in ORTHO (2D) mode to render text (see setOrtho()).
 *
 * Special thanks to NeHe and Giuseppe D'Agata for the "2D Texture Font"
 * tutorial (http://nehe.gamedev.net).//from   w w w  . j a  va 2  s .  c om
 *
 * @param charSetImage
 *            texture image containing 100 characters in a 10x10 grid
 * @param fontWidth
 *            how many pixels to allow per character on screen
 *
 * @see destroyFont()
 */
public void buildFont(int fontTxtrHandle, int textureSize, int fontSize) {
    int unitSize = fontSize; // pixel size of one block in 10x10 grid
    float usize = (float) unitSize / (float) (textureSize); // UV size of
    // one block in
    // grid
    float chU, chV; // character UV position

    // Create 100 Display Lists
    fontListBase = GL11.glGenLists(100);

    // make a quad for each character in texture
    for (int i = 0; i < 100; i++) {
        int x = (i % 10); // column
        int y = (i / 10); // row

        // make character UV coordinate
        // the character V position is tricky because we have to invert the
        // V coord
        // (char # 0 is at top of texture image, but V 0 is at bottom)
        chU = (float) (x * unitSize) / (float) textureSize;
        chV = (float) (y * unitSize) / (float) textureSize;
        // chV = (float) (textureSize - (y * unitSize) - unitSize) / (float)
        // textureSize;

        GL11.glNewList(fontListBase + i, GL11.GL_COMPILE); // start display
        // list
        {
            GL11.glBegin(GL11.GL_QUADS); // Make A unitSize square quad
            {
                GL11.glTexCoord2f(chU, chV); // Texture Coord (Bottom Left)
                GL11.glVertex2i(0, unitSize);

                GL11.glTexCoord2f(chU + usize, chV); // Texture Coord
                // (Bottom Right)
                GL11.glVertex2i(unitSize, unitSize);

                GL11.glTexCoord2f(chU + usize, chV + usize); // Texture
                // Coord
                // (Top
                // Right)
                GL11.glVertex2i(unitSize, 0);

                GL11.glTexCoord2f(chU, chV + usize); // Texture Coord (Top
                // Left)
                GL11.glVertex2i(0, 0);

            }
            GL11.glEnd();
            GL11.glTranslatef(charwidths[i], 0, 0); // shift right the width
            // of the character
        }
        GL11.glEndList(); // done display list
    }
}

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);/* ww w  . j av  a  2 s. 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();
    }
}

From source file:net.mechanicalcat.pycode.obj.Model.java

License:Open Source License

public void genList() {
    this.glList = GL11.glGenLists(1);
    GL11.glNewList(this.glList, GL11.GL_COMPILE);
    //        if use_texture: glEnable(GL_TEXTURE_2D)
    GL11.glFrontFace(GL11.GL_CCW);//from w w w  . j  av a2  s .c o  m
    GL11.glEnable(GL11.GL_CULL_FACE);

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glDepthFunc(GL11.GL_LESS);
    GL11.glCullFace(GL11.GL_BACK);
    String currentMaterial = "";
    Material mtl;
    for (Face face : this.faces) {
        if (!face.material.equals(currentMaterial)) {
            currentMaterial = face.material;
            mtl = this.materials.get(face.material);
            if (mtl == null) {
                GL11.glColor3f(1, 1, 1);
            } else {
                //                    if 'texture_Kd' in mtl:
                //                    # use diffuse texmap
                //                    glBindTexture(GL_TEXTURE_2D, mtl['texture_Kd'])
                GL11.glColor3f(mtl.diffuse.x, mtl.diffuse.y, mtl.diffuse.z);
            }
        }

        GL11.glBegin(GL11.GL_POLYGON);
        for (int i = 0; i < face.vertexes.size(); i++) {
            if (face.normals.get(i) != 0) {
                Vector3f n = this.normals.get(face.normals.get(i));
                GL11.glNormal3f(n.x, n.y, n.z);
            }
            //                if texture_coords[i]:
            //                    glTexCoord2fv(self.texcoords[texture_coords[i] - 1])
            Vector3f v = this.vertices.get(face.vertexes.get(i));
            GL11.glVertex3f(v.x, v.y, v.z);
        }
        GL11.glEnd();
    }

    GL11.glCullFace(GL11.GL_BACK);
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);

    GL11.glDisable(GL11.GL_CULL_FACE);

    //      if use_texture: glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEndList();
}

From source file:net.minecraftforge.client.CloudRenderer.java

License:Open Source License

private void build() {
    Tessellator tess = Tessellator.getInstance();
    BufferBuilder buffer = tess.getBuffer();

    if (OpenGlHelper.useVbo())
        vbo = new VertexBuffer(FORMAT);
    else/* w  ww.  j a v  a2  s  . c  o  m*/
        GlStateManager.glNewList(displayList = GLAllocation.generateDisplayLists(1), GL11.GL_COMPILE);

    vertices(buffer);

    if (OpenGlHelper.useVbo()) {
        buffer.finishDrawing();
        buffer.reset();
        vbo.bufferData(buffer.getByteBuffer());
    } else {
        tess.draw();
        GlStateManager.glEndList();
    }
}

From source file:net.quetzi.bluepower.compat.fmp.MultipartBPPart.java

License:Open Source License

@Override
public void renderDynamic(Vector3 pos, float frame, int pass) {

    getPart().renderDynamic(new net.quetzi.bluepower.api.vec.Vector3(pos.x, pos.y, pos.z), pass, frame);

    if (emptyStaticRender == -1) {
        emptyStaticRender = GL11.glGenLists(1);
        GL11.glNewList(emptyStaticRender, GL11.GL_COMPILE);
        GL11.glEndList();// ww  w. j a v  a2  s  . com
    }
    if (staticRender0 == -1 || getPart().shouldReRender())
        reRenderStatic(new Vector3(0, 0, 0), 0);
    if (staticRender1 == -1 || getPart().shouldReRender())
        reRenderStatic(new Vector3(0, 0, 0), 1);
    if (getPart().shouldReRender())
        getPart().resetRenderUpdate();

    if (getPart().shouldRenderStaticOnPass(pass)) {
        GL11.glPushMatrix();
        {
            GL11.glTranslated(pos.x, pos.y, pos.z);
            if (pass == 0) {
                GL11.glCallList(staticRender0);
            } else {
                GL11.glCallList(staticRender1);
            }
        }
        GL11.glPopMatrix();
    }

}

From source file:net.quetzi.bluepower.compat.fmp.MultipartBPPart.java

License:Open Source License

protected void reRenderStatic(Vector3 pos, int pass) {

    if (pass == 0) {
        if (staticRender0 == -1 || staticRender0 == emptyStaticRender)
            staticRender0 = GL11.glGenLists(1);
        GL11.glNewList(staticRender0, GL11.GL_COMPILE);
    } else {//from www  . ja v  a2  s . c o m
        if (staticRender1 == -1 || staticRender1 == emptyStaticRender)
            staticRender1 = GL11.glGenLists(1);
        GL11.glNewList(staticRender1, GL11.GL_COMPILE);
    }
    GL11.glPushMatrix();

    boolean result = getPart().shouldRenderStaticOnPass(pass);

    if (result) {
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        Tessellator t = Tessellator.instance;
        t.setTranslation(0, 0, 0);
        t.startDrawingQuads();
        result = getPart().renderStatic(new net.quetzi.bluepower.api.vec.Vector3(pos.x, pos.y, pos.z), pass);
        t.draw();
        t.setTranslation(0, 0, 0);
    }

    GL11.glPopMatrix();
    GL11.glEndList();
    if (!result) {
        if (pass == 0) {
            staticRender0 = emptyStaticRender;
        } else {
            staticRender1 = emptyStaticRender;
        }
    }
}

From source file:net.shadowmage.ancientwarfare.core.model.ModelPiece.java

License:Open Source License

protected void renderPrimitives(float tw, float th) {
    if (!compiled) {
        compiled = true;/*from w  w  w  .j  a v  a2 s. co  m*/
        if (displayList < 0) {
            displayList = GL11.glGenLists(1);
        }
        GL11.glNewList(displayList, GL11.GL_COMPILE);
        for (Primitive p : primitives) {
            p.render(tw, th);
        }
        GL11.glEndList();
        GL11.glCallList(displayList);
    } else {
        GL11.glCallList(displayList);
    }
}

From source file:net.smert.frameworkgl.opengl.helpers.DisplayListHelper.java

License:Apache License

public void begin(int displayListID) {
    GL11.glNewList(displayListID, GL11.GL_COMPILE);
}