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:adrianton.gloptat.plotter.Box.java

License:Open Source License

static void assemble() {
    handle = GL11.glGenLists(1);
    GL11.glNewList(handle, GL11.GL_COMPILE);

    GL11.glLineWidth(3);/*w  ww . ja v  a 2 s  .c o m*/
    GL11.glColor3f(1f, 1f, 1f);

    GL11.glBegin(GL11.GL_LINES);

    GL11.glVertex3d(-1, -1, 1);
    GL11.glVertex3d(1, -1, 1);
    GL11.glVertex3d(1, -1, 1);
    GL11.glVertex3d(1, 1, 1);
    GL11.glVertex3d(1, 1, 1);
    GL11.glVertex3d(-1, 1, 1);
    GL11.glVertex3d(-1, 1, 1);
    GL11.glVertex3d(-1, -1, 1);

    GL11.glVertex3d(-1, -1, -1);
    GL11.glVertex3d(1, -1, -1);
    GL11.glVertex3d(1, -1, -1);
    GL11.glVertex3d(1, 1, -1);
    GL11.glVertex3d(1, 1, -1);
    GL11.glVertex3d(-1, 1, -1);
    GL11.glVertex3d(-1, 1, -1);
    GL11.glVertex3d(-1, -1, -1);

    GL11.glVertex3d(-1, -1, -1);
    GL11.glVertex3d(-1, -1, 1);
    GL11.glVertex3d(1, -1, -1);
    GL11.glVertex3d(1, -1, 1);
    GL11.glVertex3d(1, 1, -1);
    GL11.glVertex3d(1, 1, 1);
    GL11.glVertex3d(-1, 1, -1);
    GL11.glVertex3d(-1, 1, 1);

    GL11.glEnd();

    GL11.glEndList();
}

From source file:adrianton.gloptat.plotter.Pointer.java

License:Open Source License

static void assemble() {
    final float tmpm = 1;
    final float tmpm2 = 1 / 3;
    final float tmpm3 = 7;

    handle = GL11.glGenLists(1);
    GL11.glNewList(handle, GL11.GL_COMPILE);

    GL11.glBegin(GL11.GL_TRIANGLES);/*from   w  w  w  . j  a  v  a  2  s . co m*/
    GL11.glColor3f(1, 1, 1);

    GL11.glVertex3f(0, 0, tmpm2);
    GL11.glVertex3f(-tmpm, -tmpm, tmpm3);
    GL11.glVertex3f(-tmpm, tmpm, tmpm3);

    GL11.glVertex3f(0, 0, tmpm2);
    GL11.glVertex3f(-tmpm, tmpm, tmpm3);
    GL11.glVertex3f(tmpm, tmpm, tmpm3);

    GL11.glVertex3f(0, 0, tmpm2);
    GL11.glVertex3f(tmpm, tmpm, tmpm3);
    GL11.glVertex3f(tmpm, -tmpm, tmpm3);

    GL11.glVertex3f(0, 0, tmpm2);
    GL11.glVertex3f(tmpm, -tmpm, tmpm3);
    GL11.glVertex3f(-tmpm, -tmpm, tmpm3);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex3f(tmpm, tmpm, tmpm3);
    GL11.glVertex3f(tmpm, -tmpm, tmpm3);
    GL11.glVertex3f(-tmpm, -tmpm, tmpm3);
    GL11.glVertex3f(-tmpm, tmpm, tmpm3);
    GL11.glEnd();

    GL11.glEndList();
}

From source file:adrianton.gloptat.plotter.Surface.java

License:Open Source License

public static void assemble(Displayer outer) {
    int i, j;/*from   w  w w. j a v  a2s . co  m*/
    float px, py;
    float z1, z2, z3, z4;
    float tmp;

    Color col;

    float spx = -outer.rezx / 2;
    float spy = -outer.rezy / 2;

    handle = GL11.glGenLists(1);
    GL11.glNewList(handle, GL11.GL_COMPILE);

    GL11.glBegin(GL11.GL_QUADS);

    px = spx;
    for (i = 0; i < outer.rezx - 1; i++) {
        py = spy;
        for (j = 0; j < outer.rezy - 1; j++) {
            z1 = (float) outer.val[i][j];
            z2 = (float) outer.val[i + 1][j];
            z3 = (float) outer.val[i][j + 1];
            z4 = (float) outer.val[i + 1][j + 1];

            tmp = (float) (1 - ((outer.val[i][j] - outer.minc) / (outer.maxc - outer.minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex3f(px, py, z1);

            tmp = (float) (1 - ((outer.val[i][j + 1] - outer.minc) / (outer.maxc - outer.minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex3f(px, py + 1, z3);

            tmp = (float) (1 - ((outer.val[i + 1][j + 1] - outer.minc) / (outer.maxc - outer.minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex3f(px + 1, py + 1, z4);

            tmp = (float) (1 - ((outer.val[i + 1][j] - outer.minc) / (outer.maxc - outer.minc)));
            tmp = tmp * 66 / 100 + 34 / 100;
            col = new Color(Color.HSBtoRGB(tmp, 0.7f, 0.85f));
            GL11.glColor3f((float) (col.getRed() / 255f), (float) (col.getGreen() / 255f),
                    (float) (col.getBlue() / 255f));

            GL11.glVertex3f(px + 1, py, z2);

            py += 1;
        }
        px += 1;
    }

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

From source file:akarnokd.opengl.experiment.Planet.java

License:Apache License

public static Planet create(String file, float radius, int smoothness) {
    Planet p = new Planet();
    p.id = ObjectTracker.add(p);/*from   w  ww. j  ava  2s.  c o  m*/
    p.radius = radius;
    p.smoothness = smoothness;

    // GLU sphere requires a mirrored texture ?!
    p.tex = Texture.fromFile(file, false, true);

    {
        Sphere sphere = new Sphere();
        sphere.setDrawStyle(GLU.GLU_FILL);
        sphere.setTextureFlag(true);
        sphere.setNormals(GLU.GLU_SMOOTH);
        sphere.setOrientation(GLU.GLU_OUTSIDE);

        p.handle = GL11.glGenLists(1);

        GL11.glNewList(p.handle, GL11.GL_COMPILE);
        p.tex.use();
        GL11.glColor4f(1, 1, 1, 1);
        sphere.draw(radius, smoothness, smoothness);
        p.tex.stop();
        GL11.glEndList();
    }
    {
        Sphere sphere2 = new Sphere();
        sphere2.setDrawStyle(GLU.GLU_FILL);
        sphere2.setNormals(GLU.GLU_SMOOTH);
        sphere2.setOrientation(GLU.GLU_OUTSIDE);

        p.handleSelect = GL11.glGenLists(1);
        GL11.glNewList(p.handleSelect, GL11.GL_COMPILE);
        G2D.color(p.id);
        sphere2.draw(radius, smoothness, smoothness);
        GL11.glEndList();
    }
    {
        Sphere sphere2 = new Sphere();
        sphere2.setDrawStyle(GLU.GLU_LINE);
        sphere2.setNormals(GLU.GLU_NONE);

        p.wireframe = GL11.glGenLists(1);
        GL11.glNewList(p.wireframe, GL11.GL_COMPILE);
        sphere2.draw(radius, smoothness, smoothness);
        GL11.glEndList();
    }

    return p;
}

From source file:cn.lambdalib.util.deprecated.Mesh.java

License:MIT License

private void redraw(Material mat, boolean execute) {
    if (doesBuffer) {
        if (listID == -1) {
            listID = GL11.glGenLists(1);
            GL11.glNewList(listID, execute ? GL11.GL_COMPILE_AND_EXECUTE : GL11.GL_COMPILE);
        }//from w  ww. j  a va2  s .c  o m
    }

    mat.onRenderStage(RenderStage.START);
    GL11.glPushMatrix();

    mat.onRenderStage(RenderStage.BEFORE_TESSELLATE);
    Tessellator t = Tessellator.instance;
    t.startDrawing(GL11.GL_TRIANGLES);
    mat.onRenderStage(RenderStage.START_TESSELLATE);

    if (uvs != null) {
        if (triangles != null) {
            for (int i : triangles) {
                double[] vert = vertices[i];
                double[] uv = uvs[i];
                if (normals != null) {
                    t.setNormal(normals[i][0], normals[i][1], normals[i][2]);
                }
                t.addVertexWithUV(vert[0], vert[1], vert[2], uv[0], uv[1]);

            }
        }
    } else {
        if (triangles != null) {
            for (int i : triangles) {
                double[] vert = vertices[i];
                if (normals != null) {
                    t.setNormal(normals[i][0], normals[i][1], normals[i][2]);
                }
                t.addVertex(vert[0], vert[1], vert[2]);
            }
        }
    }
    t.draw();

    GL11.glPopMatrix();
    mat.onRenderStage(RenderStage.END);

    for (Mesh m : this.sub) {
        m.draw(mat);
    }

    if (doesBuffer) {
        GL11.glEndList();
    }
}

From source file:com.ardor3d.renderer.lwjgl.LwjglFont.java

License:Open Source License

/**
 * <code>buildDisplayList</code> sets up the 256 display lists that are used to render each font character. Each
 * list quad is 16x16, as defined by the font image size.
 *///from   w  w w.  j  a  v  a 2s. c om
public void buildDisplayList() {
    float cx;
    float cy;

    base = GL11.glGenLists(256);

    for (int loop = 0; loop < 256; loop++) {
        cx = (loop % 16) / 16.0f;
        cy = (loop / 16) / 16.0f;

        GL11.glNewList(base + loop, GL11.GL_COMPILE);
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(cx, 1 - cy - 0.0625f);
        GL11.glVertex2i(0, 0);
        GL11.glTexCoord2f(cx + 0.0625f, 1 - cy - 0.0625f);
        GL11.glVertex2i(16, 0);
        GL11.glTexCoord2f(cx + 0.0625f, 1 - cy);
        GL11.glVertex2i(16, 16);
        GL11.glTexCoord2f(cx, 1 - cy);
        GL11.glVertex2i(0, 16);
        GL11.glEnd();
        GL11.glTranslatef(10, 0, 0);
        GL11.glEndList();
    }
}

From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java

License:Open Source License

/**
 * Start a new display list. All further renderer commands that can be stored in a display list are part of this new
 * list until {@link #endDisplayList()} is called.
 * //from   www.ja  va 2 s .c  o  m
 * @return id of new display list
 */
public int startDisplayList() {
    final int id = GL11.glGenLists(1);

    GL11.glNewList(id, GL11.GL_COMPILE);

    return id;
}

From source file:com.blogspot.jabelarminecraft.blocksmith.proxy.ClientProxy.java

License:Open Source License

public void createSphereCallList() {
    Sphere sphere = new Sphere();
    //GLU_POINT will render it as dots.
    //GLU_LINE will render as wireframe
    //GLU_SILHOUETTE will render as ?shadowed? wireframe
    //GLU_FILL as a solid.
    sphere.setDrawStyle(GLU.GLU_FILL);/*  w  ww  . ja  v  a  2 s . c  om*/
    //GLU_SMOOTH will try to smoothly apply lighting
    //GLU_FLAT will have a solid brightness per face, and will not shade.
    //GLU_NONE will be completely solid, and probably will have no depth to it's appearance.
    sphere.setNormals(GLU.GLU_SMOOTH);
    //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_OUTSIDE);
    sphereIdOutside = GL11.glGenLists(1);
    //Create a new list to hold our sphere data.
    GL11.glNewList(sphereIdOutside, GL11.GL_COMPILE);
    //binds the texture 
    ResourceLocation rL = new ResourceLocation(BlockSmith.MODID + ":textures/entities/sphere.png");
    Minecraft.getMinecraft().getTextureManager().bindTexture(rL);
    //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables
    //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();

    //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_INSIDE);
    sphereIdInside = GL11.glGenLists(1);
    //Create a new list to hold our sphere data.
    GL11.glNewList(sphereIdInside, GL11.GL_COMPILE);
    Minecraft.getMinecraft().getTextureManager().bindTexture(rL);
    //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables
    //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();
}

From source file:com.blogspot.jabelarminecraft.magicbeans.proxy.ClientProxy.java

License:Open Source License

public void createSphereCallList() {
    Sphere sphere = new Sphere();
    //GLU_POINT will render it as dots.
    //GLU_LINE will render as wireframe
    //GLU_SILHOUETTE will render as ?shadowed? wireframe
    //GLU_FILL as a solid.
    sphere.setDrawStyle(GLU.GLU_FILL);//from  w  w w.j a v  a2s.  com
    //GLU_SMOOTH will try to smoothly apply lighting
    //GLU_FLAT will have a solid brightness per face, and will not shade.
    //GLU_NONE will be completely solid, and probably will have no depth to it's appearance.
    sphere.setNormals(GLU.GLU_SMOOTH);
    //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_OUTSIDE);
    sphereIdOutside = GL11.glGenLists(1);
    //Create a new list to hold our sphere data.
    GL11.glNewList(sphereIdOutside, GL11.GL_COMPILE);
    //binds the texture 
    ResourceLocation rL = new ResourceLocation(MagicBeans.MODID + ":textures/entities/sphere.png");
    Minecraft.getMinecraft().getTextureManager().bindTexture(rL);
    //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables
    //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();

    //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_INSIDE);
    sphereIdInside = GL11.glGenLists(1);
    //Create a new list to hold our sphere data.
    GL11.glNewList(sphereIdInside, GL11.GL_COMPILE);
    Minecraft.getMinecraft().getTextureManager().bindTexture(rL);
    //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables
    //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();
}

From source file:com.blogspot.jabelarminecraft.movinglightsource.proxy.ClientProxy.java

License:Open Source License

public void createSphereCallList() {
    Sphere sphere = new Sphere();
    //GLU_POINT will render it as dots.
    //GLU_LINE will render as wireframe
    //GLU_SILHOUETTE will render as ?shadowed? wireframe
    //GLU_FILL as a solid.
    sphere.setDrawStyle(GLU.GLU_FILL);/*from  w  ww  .j a  va 2s  .  c om*/
    //GLU_SMOOTH will try to smoothly apply lighting
    //GLU_FLAT will have a solid brightness per face, and will not shade.
    //GLU_NONE will be completely solid, and probably will have no depth to it's appearance.
    sphere.setNormals(GLU.GLU_SMOOTH);
    //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_OUTSIDE);
    sphereIdOutside = GL11.glGenLists(1);
    //Create a new list to hold our sphere data.
    GL11.glNewList(sphereIdOutside, GL11.GL_COMPILE);
    //binds the texture 
    ResourceLocation rL = new ResourceLocation(MovingLightSource.MODID + ":textures/entities/sphere.png");
    Minecraft.getMinecraft().getTextureManager().bindTexture(rL);
    //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables
    //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();

    //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered)
    sphere.setOrientation(GLU.GLU_INSIDE);
    sphereIdInside = GL11.glGenLists(1);
    //Create a new list to hold our sphere data.
    GL11.glNewList(sphereIdInside, GL11.GL_COMPILE);
    Minecraft.getMinecraft().getTextureManager().bindTexture(rL);
    //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables
    //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s
    sphere.draw(0.5F, 32, 32);
    GL11.glEndList();
}