Example usage for org.lwjgl.opengl GL11 glGenLists

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

Introduction

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

Prototype

@NativeType("GLuint")
public static native int glGenLists(@NativeType("GLsizei") int s);

Source Link

Document

Returns an integer n such that the indices n,..., n + s - 1 are previously unused (i.e.

Usage

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);

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    GL11.glEnable(GL11.GL_LIGHTING);/*ww  w  .  j a  v  a2s  .  c  o  m*/
    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);

    GL11.glNewList(display_list, GL11.GL_COMPILE);

    // draw the grid
    GL11.glBegin(GL11.GL_LINES);//from w w w  .  ja v  a 2 s.  c o m

    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  . j a  v  a 2  s  .com*/
    }

    // 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: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  .  ja  va  2s.  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 w  w w  .j  av  a  2  s  . 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 a  va2  s  .co  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();
}

From source file:fable.imageviewer.views.ReliefView.java

License:Open Source License

private void drawReliefList() {
    // long started = System.currentTimeMillis();
    if (!reliefListFirst) {
        GL11.glDeleteLists(reliefList, 1);
    }/*www  .  j  a va2 s.  c  om*/
    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; i++) {
        GL11.glBegin(GL11.GL_LINE_STRIP);
        for (int j = 0; j < imageHeight; j++) {
            int color_index;
            color_index = (int) image[j * imageWidth + i];
            if (color_index < 0)
                color_index = 0;
            if (color_index > colorIndexMax)
                color_index = colorIndexMax;
            GL11.glColor3f(red[color_index], green[color_index], blue[color_index]); // temperature lut
            GL11.glVertex3f(i, j, image[j * imageWidth + i]);
        }
        GL11.glEnd();
    }
    for (int i = 0; i < imageHeight; i++) {
        GL11.glBegin(GL11.GL_LINE_STRIP);
        for (int j = 0; j < imageWidth; j++) {
            int color_index;
            color_index = (int) image[i * imageWidth + j];
            if (color_index < 0)
                color_index = 0;
            if (color_index > colorIndexMax)
                color_index = colorIndexMax;
            GL11.glColor3f(red[color_index], green[color_index], blue[color_index]); // temperature lut
            GL11.glVertex3f(j, i, image[i * imageWidth + j]);
        }
        GL11.glEnd();
    }
    GL11.glEndList();
    // long elapsed = System.currentTimeMillis()-started;
    // logger.debug("time to draw relief list "+elapsed+" ms");
}

From source file:illarion.graphics.lwjgl.TextureLWJGL.java

License:Open Source License

/**
 * Generate the display list in case its needed and return the ID of the
 * list needed to display this texture./*from   w  w  w . j  a  v  a 2s  .  c o  m*/
 * 
 * @return the ID of the display list
 */
public int getDisplayListID() {
    if ((displayListID == -1) || displayListDirty) {
        if (displayListID == -1) {
            displayListID = GL11.glGenLists(1);
        }

        GL11.glNewList(displayListID, GL11.GL_COMPILE);
        GL11.glBegin(GL11.GL_TRIANGLE_STRIP);

        GL11.glTexCoord2f(getRelX1(), getRelY2());
        GL11.glVertex2f(-0.5f, -0.5f);
        GL11.glTexCoord2f(getRelX1(), getRelY1());
        GL11.glVertex2f(-0.5f, 0.5f);
        GL11.glTexCoord2f(getRelX2(), getRelY2());
        GL11.glVertex2f(0.5f, -0.5f);
        GL11.glTexCoord2f(getRelX2(), getRelY1());
        GL11.glVertex2f(0.5f, 0.5f);

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

        displayListDirty = false;
    }

    return displayListID;
}

From source file:io.flob.blackheart.Level.java

License:Open Source License

private void load_display_list() throws Exception {
    display_list = GL11.glGenLists(1);
    GL11.glNewList(display_list, GL11.GL_COMPILE);
    for (int count = 0; count < objects_static.size(); count++) {
        objects_static.get(count).tick();
    }/*from w ww . j a  va 2s.c o m*/
    GL11.glEndList();
    display_list_dirty = false;
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static int glGenLists(int count) {
    return GL11.glGenLists(count);
}