Example usage for org.lwjgl.opengl GL11 glEndList

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

Introduction

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

Prototype

public static native void glEndList();

Source Link

Document

Ends the definition of GL commands to be placed in a display list.

Usage

From source file:com.github.begla.blockmania.rendering.helper.Primitives.java

License:Apache License

public static int generateColoredBlock(Vector4f color, float size) {
    int id = glGenLists(1);

    GL11.glNewList(id, GL11.GL_COMPILE);
    GL11.glBegin(GL11.GL_QUADS);/*from w w  w.  ja  v  a 2s  .co m*/

    GL11.glColor4f(color.x, color.y, color.z, color.w);

    float sHalf = size / 2;

    // TOP
    GL11.glVertex3f(-sHalf, sHalf, sHalf);
    GL11.glVertex3f(sHalf, sHalf, sHalf);
    GL11.glVertex3f(sHalf, sHalf, -sHalf);
    GL11.glVertex3f(-sHalf, sHalf, -sHalf);

    // LEFT
    GL11.glVertex3f(-sHalf, -sHalf, -sHalf);
    GL11.glVertex3f(-sHalf, -sHalf, sHalf);
    GL11.glVertex3f(-sHalf, sHalf, sHalf);
    GL11.glVertex3f(-sHalf, sHalf, -sHalf);

    // RIGHT
    GL11.glVertex3f(sHalf, sHalf, -sHalf);
    GL11.glVertex3f(sHalf, sHalf, sHalf);
    GL11.glVertex3f(sHalf, -sHalf, sHalf);
    GL11.glVertex3f(sHalf, -sHalf, -sHalf);

    GL11.glColor4f(0.85f * color.x, 0.85f * color.y, 0.85f * color.z, color.w);

    // FRONT
    GL11.glVertex3f(-sHalf, sHalf, -sHalf);
    GL11.glVertex3f(sHalf, sHalf, -sHalf);
    GL11.glVertex3f(sHalf, -sHalf, -sHalf);
    GL11.glVertex3f(-sHalf, -sHalf, -sHalf);

    // BACK
    GL11.glVertex3f(-sHalf, -sHalf, sHalf);
    GL11.glVertex3f(sHalf, -sHalf, sHalf);
    GL11.glVertex3f(sHalf, sHalf, sHalf);
    GL11.glVertex3f(-sHalf, sHalf, sHalf);

    // BOTTOM
    GL11.glVertex3f(-sHalf, -sHalf, -sHalf);
    GL11.glVertex3f(sHalf, -sHalf, -sHalf);
    GL11.glVertex3f(sHalf, -sHalf, sHalf);
    GL11.glVertex3f(-sHalf, -sHalf, sHalf);

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

    return id;
}

From source file:com.kegare.frozenland.client.renderer.FrozenlandSkyRenderer.java

License:Minecraft Mod Public

public FrozenlandSkyRenderer() {
    this.starGLCallList = GLAllocation.generateDisplayLists(3);
    GL11.glPushMatrix();/*  w  ww .  j  a v  a  2 s . c o m*/
    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();//from  w ww. j ava  2 s.  co  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);
    }// w w w.j  av  a  2  s .c om

    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 ww. j av a2  s  . c om*/

    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);//ww w  .ja va  2s  .  co  m

    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 ww .  jav a2s .  c  o m
    }

    // 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;//from  ww  w  .j  ava2s.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);
    }//  w w w. j a  va2 s.co 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  w  w w  .j a  va 2  s. c  o  m*/
        this.render(model);
    }
    GL11.glEndList();
    return displayList;
}