Example usage for org.lwjgl.opengl GL11 GL_COMPILE

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

Introduction

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

Prototype

int GL_COMPILE

To view the source code for org.lwjgl.opengl GL11 GL_COMPILE.

Click Source Link

Document

ListMode

Usage

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

License:Open Source License

public SkyRendererMoon(IMinestellarWorldProvider moonProvider) {
    GL11.glPushMatrix();/*w w  w.j  av  a 2s .  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);
    }//from   w w  w  . j  a  v a2  s.c  o 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);/*ww  w . ja 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);/* ww  w. j a v a 2 s .  c  o  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;// w w  w  . j ava  2  s  .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   w w  w  . j  a  v  a2  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);
    }/*  w w  w . j av  a  2 s  .  com*/

    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:de.sanandrew.mods.turretmod.client.render.tileentity.RenderElectrolyteGenerator.java

License:Creative Commons License

private static void drawParaboleWire(int steps) {
    if (wireCallList == 0) {
        double scale = 0.01D;
        final double perpendAngle = 90.0D * Math.PI / 180.0D;

        Vec3d[] builtVecMain = new Vec3d[steps + 1];
        Vec3d[] builtVecA = new Vec3d[steps + 1];
        Vec3d[] builtVecB = new Vec3d[steps + 1];

        for (int i = 0; i <= steps; i++) {
            double x = i / (double) steps;
            double y = Math.pow(x, 4.0D);
            builtVecMain[i] = new Vec3d(x * -0.35D, y * -0.5D, 0.00D);
            builtVecA[i] = new Vec3d(x * -0.35D, y * -0.5D, 0.0D);
            builtVecB[i] = new Vec3d(x * -0.35D, y * -0.5D, 0.0D);
        }//  www . j ava  2  s .c  o  m

        builtVecA[0] = builtVecMain[0].add(
                rotateVecXY(builtVecMain[1].subtract(builtVecMain[0]).normalize().scale(scale), perpendAngle));
        builtVecB[0] = builtVecMain[0].add(
                rotateVecXY(builtVecMain[1].subtract(builtVecMain[0]).normalize().scale(scale), -perpendAngle));

        for (int i = 1; i < builtVecA.length - 1; i++) {
            Vec3d vecBtwPre = builtVecMain[i].subtract(builtVecMain[i - 1]);
            Vec3d vecBtwPost = builtVecMain[i + 1].subtract(builtVecMain[i]);
            double btwAngle = Math.acos(
                    vecBtwPre.dotProduct(vecBtwPost) / (vecBtwPre.lengthVector() * vecBtwPost.lengthVector()));
            builtVecA[i] = builtVecMain[i]
                    .add(rotateVecXY(vecBtwPre.normalize().scale(scale), perpendAngle + btwAngle / 2.0D));
            builtVecB[i] = builtVecMain[i]
                    .add(rotateVecXY(vecBtwPre.normalize().scale(scale), -perpendAngle - btwAngle / 2.0D));
        }

        Vec3d vecBtw = builtVecMain[builtVecMain.length - 1].subtract(builtVecMain[builtVecMain.length - 2])
                .normalize().scale(scale);
        builtVecA[builtVecA.length - 1] = builtVecMain[builtVecMain.length - 1]
                .add(rotateVecXY(vecBtw, perpendAngle));
        builtVecB[builtVecA.length - 1] = builtVecMain[builtVecMain.length - 1]
                .add(rotateVecXY(vecBtw, -perpendAngle));

        wireCallList = GlStateManager.glGenLists(1);
        if (wireCallList == 0) {
            return;
        }

        GlStateManager.glNewList(wireCallList, GL11.GL_COMPILE);

        Tessellator tess = Tessellator.getInstance();
        BufferBuilder buf = tess.getBuffer();

        buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

        for (int i = 0; i < builtVecA.length - 1; i++) {
            final double u = Math.abs(builtVecA[i + 1].subtract(builtVecA[i]).lengthVector()) * 4.5D;

            buf.pos(builtVecA[i].x, builtVecA[i].y, -scale).tex(0.0D, 1.0D).endVertex();
            buf.pos(builtVecA[i + 1].x, builtVecA[i + 1].y, -scale).tex(u, 1.0D).endVertex();
            buf.pos(builtVecB[i + 1].x, builtVecB[i + 1].y, scale).tex(u, 0.0D).endVertex();
            buf.pos(builtVecB[i].x, builtVecB[i].y, scale).tex(0.0D, 0.0D).endVertex();

            buf.pos(builtVecA[i].x, builtVecA[i].y, scale).tex(0.0D, 1.0D).endVertex();
            buf.pos(builtVecA[i + 1].x, builtVecA[i + 1].y, scale).tex(u, 1.0D).endVertex();
            buf.pos(builtVecB[i + 1].x, builtVecB[i + 1].y, -scale).tex(u, 0.0D).endVertex();
            buf.pos(builtVecB[i].x, builtVecB[i].y, -scale).tex(0.0D, 0.0D).endVertex();
        }

        tess.draw();

        GlStateManager.glEndList();
    }

    GlStateManager.callList(wireCallList);
}

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

License:Open Source License

/**
 * Build the list to display here//from   www . j av  a  2 s  .  com
 */
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);
    }/*from   w  ww  .  j  a va  2s  . c  o  m*/
    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");
}