Example usage for org.lwjgl.opengl GL11 glNewList

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

Introduction

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

Prototype

public static native void glNewList(@NativeType("GLuint") int n, @NativeType("GLenum") int mode);

Source Link

Document

Begins the definition of a display list.

Usage

From source file:net.minecraft.src.buildcraft.transport.RenderPipe.java

License:Minecraft Mod Public

private DisplayLiquidList getDisplayLiquidLists(int liquidId, World world) {
    if (displayLiquidLists.containsKey(liquidId))
        return displayLiquidLists.get(liquidId);

    DisplayLiquidList d = new DisplayLiquidList();
    displayLiquidLists.put(liquidId, d);

    BlockInterface block = new BlockInterface();
    if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null)
        block.texture = Block.blocksList[liquidId].blockIndexInTexture;
    else// w  w w  .j a  v a  2 s  . c  o m
        block.texture = Item.itemsList[liquidId].getIconFromDamage(0);
    float size = Utils.pipeMaxPos - Utils.pipeMinPos;

    // render size

    for (int s = 0; s < displayLiquidStages; ++s) {
        float ratio = (float) s / (float) displayLiquidStages;

        // SIDE HORIZONTAL

        d.sideHorizontal[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(d.sideHorizontal[s], 4864 /* GL_COMPILE */);

        block.minX = 0.0F;
        block.minZ = Utils.pipeMinPos + 0.01F;

        block.maxX = block.minX + size / 2F + 0.01F;
        block.maxZ = block.minZ + size - 0.02F;

        block.minY = Utils.pipeMinPos + 0.01F;
        block.maxY = block.minY + (size - 0.02F) * ratio;

        RenderEntityBlock.renderBlock(block, world, 0, 0, 0, false, true);

        GL11.glEndList();

        // SIDE VERTICAL

        d.sideVertical[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(d.sideVertical[s], 4864 /* GL_COMPILE */);

        block.minY = Utils.pipeMaxPos - 0.01;
        block.maxY = 1;

        block.minX = 0.5 - (size / 2 - 0.01) * ratio;
        block.maxX = 0.5 + (size / 2 - 0.01) * ratio;

        block.minZ = 0.5 - (size / 2 - 0.01) * ratio;
        block.maxZ = 0.5 + (size / 2 - 0.01) * ratio;

        RenderEntityBlock.renderBlock(block, world, 0, 0, 0, false, true);

        GL11.glEndList();

        // CENTER HORIZONTAL

        d.centerHorizontal[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(d.centerHorizontal[s], 4864 /* GL_COMPILE */);

        block.minX = Utils.pipeMinPos + 0.01;
        block.minZ = Utils.pipeMinPos + 0.01;

        block.maxX = block.minX + size - 0.02;
        block.maxZ = block.minZ + size - 0.02;

        block.minY = Utils.pipeMinPos + 0.01;
        block.maxY = block.minY + (size - 0.02F) * ratio;

        RenderEntityBlock.renderBlock(block, world, 0, 0, 0, false, true);

        GL11.glEndList();

        // CENTER VERTICAL

        d.centerVertical[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(d.centerVertical[s], 4864 /* GL_COMPILE */);

        block.minY = Utils.pipeMinPos + 0.01;
        block.maxY = Utils.pipeMaxPos - 0.01;

        block.minX = 0.5 - (size / 2 - 0.02) * ratio;
        block.maxX = 0.5 + (size / 2 - 0.02) * ratio;

        block.minZ = 0.5 - (size / 2 - 0.02) * ratio;
        block.maxZ = 0.5 + (size / 2 - 0.02) * ratio;

        RenderEntityBlock.renderBlock(block, world, 0, 0, 0, false, true);

        GL11.glEndList();

    }

    return d;
}

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();/*from   w w  w  .ja v  a2 s  .co m*/
    }
    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  ww  w.  j  a va  2s  .  com*/
        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;//w w w.j  a  v  a  2 s. c  o  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);
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *//*from   www. j  a va2s.  c  o  m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 1; i += 2)
        GL11.glVertex2f(values[i], values[i + 1]);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *///from w ww .  j a  va 2 s  .  co  m
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 2; i += 3)
        GL11.glVertex3f(values[i], values[i + 1], values[i + 2]);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *//*w w  w  .  j a v a2  s .  c o  m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileFourPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 3; i += 4)
        GL11.glVertex4f(values[i], values[i + 1], values[i + 2], values[i + 3]);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list with color.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 *//*from ww w  .  j a v  a2 s . c o m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float[] vertexValues, float[] colorValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 1; i += 2, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glVertex2f(vertexValues[i], vertexValues[i + 1]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Compiles or and draws a display list with color.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 *//*from  www  . j a  v a 2s. co m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float[] vertexValues, float[] colorValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 2; i += 3, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glVertex3f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2]);
    }
    GL11.glEnd();
    GL11.glEndList();
}