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:com.kegare.frozenland.client.renderer.FrozenlandSkyRenderer.java

License:Minecraft Mod Public

public FrozenlandSkyRenderer() {
    this.starGLCallList = GLAllocation.generateDisplayLists(3);
    GL11.glPushMatrix();/*from  ww w .  j ava  2 s  .  c om*/
    GL11.glNewList(starGLCallList, GL11.GL_COMPILE);
    renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();
}

From source file:com.minestellar.moon.world.SkyRendererMoon.java

License:Open Source License

public SkyRendererMoon(IMinestellarWorldProvider moonProvider) {
    GL11.glPushMatrix();/*  w  ww .  j  a v a2s.c  o  m*/
    GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();
    final Tessellator tessellator = Tessellator.instance;
    this.glSkyList = this.starGLCallList + 1;
    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();
    this.glSkyList2 = this.starGLCallList + 2;
    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:com.parachute.client.ParachuteModelRenderer.java

License:Open Source License

private void compileDisplayList(float f) {
    displayList = GLAllocation.generateDisplayLists(1);
    GL11.glNewList(displayList, GL11.GL_COMPILE);
    Tessellator tessellator = Tessellator.getInstance();

    for (ParachuteTexturedQuad face : faces) {
        face.draw(tessellator.getWorldRenderer(), f);
    }//www  .  j  av a2s.co m

    GL11.glEndList();
    compiled = true;
}

From source file:com.rvantwisk.cnctools.controls.opengl.BeadActor.java

License:Open Source License

@Override
public void initialize() {
    ambient = allocFloats(colorDefaultDiffuse);
    diffuse = allocFloats(colorDefaultDiffuse);
    specular = allocFloats(colorDefaultSpecular);
    shininess = allocFloats(new float[] { 32.0f, 0.0f, 0.0f, 0.0f });

    light = allocFloats(colorDefaultLight);
    lightPos0 = allocFloats(lightDefaultPos0);
    lightPos1 = allocFloats(lightDefaultPos1);

    display_list = GL11.glGenLists(1);//from   w  w w .j a v  a2s . c  o  m

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnable(GL11.GL_LIGHT1);
    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT, ambient);
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE, diffuse);
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, specular);
    GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SHININESS, shininess);

    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, light);
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, light);
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, light);

    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, lightPos0);
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, lightPos1);

    GL11.glColor3f(1.0f, 0.0f, 0.0f);

    Sphere s = new Sphere();
    s.setDrawStyle(GLU.GLU_FILL);
    s.setNormals(GLU.GLU_SMOOTH);
    s.draw(3.8f, 100, 100);

    GL11.glDisable(GL11.GL_LIGHT1);
    GL11.glDisable(GL11.GL_LIGHT0);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glEndList();

}

From source file:com.rvantwisk.cnctools.controls.opengl.PlatformActor.java

License:Open Source License

@Override
public void initialize() {

    display_list = GL11.glGenLists(1);/*w  w  w  . ja  v a2  s . c om*/

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    // draw the grid
    GL11.glBegin(GL11.GL_LINES);

    for (int i = xneg; i <= xpos; i += openNess) {
        setColor(i);
        GL11.glVertex3f(i, yneg, ZPOS);
        GL11.glVertex3f(i, ypos, ZPOS);
    }

    for (int i = yneg; i <= ypos; i += openNess) {
        setColor(i);
        GL11.glVertex3f(xneg, i, ZPOS);
        GL11.glVertex3f(xpos, i, ZPOS);
    }

    GL11.glColor4f(color_fill[0], color_fill[1], color_fill[2], color_fill[3]);
    GL11.glRectf(xneg, yneg, xpos, ypos);
    GL11.glEnd();

    GL11.glEndList();
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

private void prepareDisplayLists(Node node) {
    if (node == null || node.bounds.width == 0 || node.bounds.height == 0) {
        return;//from  w w  w.  ja v a  2s.  c om
    }

    // Background.
    final Drawable background = node.getBackground();
    if (background.type != ContentType.NONE) {
        // Begin list.
        background.displayListId = GL11.glGenLists(1);
        GL11.glNewList(background.displayListId, GL11.GL_COMPILE);

        if (background.type == ContentType.COLOR) {
            drawColor(node, background.color);
        } else if (background.type == ContentType.IMAGE && background.texureId != -1) {
            drawImage(node, background.texureId, true);
        }

        // End list.
        GL11.glEndList();
    }

    // Content.
    final Drawable content = node.getContent();
    if (content.type != ContentType.NONE && content.texureId != -1) {
        // Begin list.
        content.displayListId = GL11.glGenLists(1);
        GL11.glNewList(content.displayListId, GL11.GL_COMPILE);

        drawImage(node, content.texureId, false);

        // End list.
        GL11.glEndList();
    }

    for (Node child : node.children) {
        prepareDisplayLists(child);
    }
}

From source file:com.yogpc.qp.client.RenderRefinery.java

License:Open Source License

private static int[] getFluidDisplayLists(final FluidStack fluidStack) {
    final Fluid fluid = fluidStack.getFluid();
    if (fluid == null)
        return null;
    final Map<Fluid, int[]> cache = stillRenderCache;
    int[] diplayLists = cache.get(fluid);
    if (diplayLists != null)
        return diplayLists;
    diplayLists = new int[100];
    Block baseBlock;//  ww w.ja  v a 2 s. c  o m
    IIcon texture;
    if (fluid.getBlock() != null) {
        baseBlock = fluid.getBlock();
        texture = fluid.getStillIcon();
    } else {
        baseBlock = Blocks.water;
        texture = fluid.getStillIcon();
    }
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    for (int s = 0; s < 100; ++s) {
        diplayLists[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(diplayLists[s], GL11.GL_COMPILE);
        final Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        renderBlocks.setRenderBounds(0.01, 0, 0.01, 0.99, (float) s / 100, 0.99);
        renderBlocks.renderFaceYNeg(baseBlock, 0, 0, 0,
                texture != null ? texture : baseBlock.getBlockTextureFromSide(0));
        renderBlocks.renderFaceYPos(baseBlock, 0, 0, 0,
                texture != null ? texture : baseBlock.getBlockTextureFromSide(1));
        renderBlocks.renderFaceZNeg(baseBlock, 0, 0, 0,
                texture != null ? texture : baseBlock.getBlockTextureFromSide(2));
        renderBlocks.renderFaceZPos(baseBlock, 0, 0, 0,
                texture != null ? texture : baseBlock.getBlockTextureFromSide(3));
        renderBlocks.renderFaceXNeg(baseBlock, 0, 0, 0,
                texture != null ? texture : baseBlock.getBlockTextureFromSide(4));
        renderBlocks.renderFaceXPos(baseBlock, 0, 0, 0,
                texture != null ? texture : baseBlock.getBlockTextureFromSide(5));
        tessellator.draw();
        GL11.glEndList();
    }
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    cache.put(fluid, diplayLists);
    return diplayLists;
}

From source file:de.kitsunealex.projectx.client.render.RenderTruncatedIcosahedron.java

License:Open Source License

private void generate() {
    int[] s = { 1, -1 };

    for (int i = 0; i < 4; i++) {
        VERTS[i] = new Vector3(0D, s[(i / 2)], s[(i % 2)] * 3 * MathHelper.phi);
    }/*from   w w  w. j  av a2  s .  c  o  m*/

    for (int i = 0; i < 8; i++) {
        VERTS[(i + 4)] = new Vector3(s[(i / 4)] * 2, s[(i / 2 % 2)] * 4.2360679999999995D,
                s[(i % 2)] * MathHelper.phi);
        VERTS[(i + 12)] = new Vector3(s[(i / 4)], s[(i / 2 % 2)] * 3.6180339999999998D,
                s[(i % 2)] * 2 * MathHelper.phi);
    }

    for (int i = 0; i < 20; i++) {
        VERTS[(i + 20)] = new Vector3(VERTS[i].y, VERTS[i].z, VERTS[i].x);
        VERTS[(i + 40)] = new Vector3(VERTS[i].z, VERTS[i].x, VERTS[i].y);
    }

    LIST_INDEX = GL11.glGenLists(2);
    GL11.glNewList(LIST_INDEX, GL11.GL_COMPILE);
    GL11.glBegin(GL11.GL_LINE_BIT);

    for (int rot = 0; rot < 3; rot++) {
        for (int i = 0; i < 4; i++) {
            pentagon(rot, i);
        }
    }

    GL11.glEnd();
    GL11.glEndList();
    GL11.glNewList(LIST_INDEX + 1, GL11.GL_COMPILE);
    GL11.glBegin(GL11.GL_LINE_BIT);

    for (int rot = 0; rot < 3; rot++) {
        for (int i = 0; i < 4; i++) {
            hexagon1(rot, i);
        }
    }

    for (int i = 0; i < 8; i++) {
        hexagon2(i);
    }

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

From source file:engine.obj.OBJLoader.java

License:Open Source License

public int createDisplayList(Obj model) {
    int displayList = GL11.glGenLists(1);
    GL11.glNewList(displayList, GL_COMPILE);
    {/*from ww  w .j ava2s . co  m*/
        this.render(model);
    }
    GL11.glEndList();
    return displayList;
}

From source file:fable.framework.ui.views.chiPlotView.java

License:Open Source License

/**
 * Build the list to display here/*w w  w  .  j av a 2s .c o m*/
 */
private static void drawReliefList() {

    if (!reliefListFirst) {
        GL11.glDeleteLists(reliefList, 1);
    }
    reliefListFirst = false;
    reliefList = GL11.glGenLists(1);
    GL11.glNewList(reliefList, GL11.GL_COMPILE);
    GL11.glColor3f(1.0f, 1.0f, 1.0f); // white
    GL11.glPointSize(pointSize);
    for (int i = 0; i < imageWidth - 1; i++) {
        GL11.glBegin(GL11.GL_LINE_STRIP);
        int j = i + 1;
        int color_index = (int) image[i];
        if (color_index < 0)
            color_index = 0;
        if (color_index > COLOR_INDEX_MAX)
            color_index = COLOR_INDEX_MAX;
        GL11.glColor3f(red[color_index], green[color_index], blue[color_index]); // temperature lut
        GL11.glVertex3f(i, image[i], image[j]);
        // System.out.println("i=" + i + ", j=" + j + " image[i]=" +
        // image[i] + " image[j]=" + image[j]);
        GL11.glEnd();
    }
    /*
     * gl.glBegin(GL.GL_TRIANGLES);
     * 
     * gl.glVertex3f(-1.0f, -0.5f, 0.0f); // lower left vertex
     * gl.glVertex3f( 1.0f, -0.5f, 0.0f); // lower right vertex
     * gl.glVertex3f( 0.0f, 0.5f, 0.0f); // upper vertex
     * 
     * gl.glEnd();
     */
    GL11.glEndList();
    GL11.glFlush();
}