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:fable.framework.ui.views.chiPlotView.java

License:Open Source License

/**
 * Build the list to display here//  w  w  w . j av a  2 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);
    }//from w  w w .j ava2 s . co  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");
}

From source file:fexcraft.tmt.slim.ModelRendererTurbo.java

private void compileDisplayList(float scale) {
    if (useLegacyCompiler) {
        compileLegacyDisplayList(scale);
    } else {// w  w w . j  a  va 2 s.co  m
        Iterator<TextureGroup> itr = textureGroup.values().iterator();
        displayListArray = new int[textureGroup.size()];
        for (int i = 0; itr.hasNext(); i++) {
            if (displayList != null) {
                displayListArray[i] = GLAllocation.generateDisplayLists(1);
                GL11.glNewList(displayListArray[i], GL11.GL_COMPILE);
                TextureGroup usedGroup = itr.next();
                for (int j = 0; j < usedGroup.poly.size(); j++) {
                    usedGroup.poly.get(j).draw(scale);
                }
                GL11.glEndList();
            } else {
                TextureGroup usedGroup = itr.next();
                for (int j = 0; j < usedGroup.poly.size(); j++) {
                    usedGroup.poly.get(j).draw(scale);
                }
            }
        }
    }
    compiled = true;
}

From source file:fexcraft.tmt.slim.ModelRendererTurbo.java

private void compileLegacyDisplayList(float scale) {
    if (displayList != null) {
        displayList = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(displayList, GL11.GL_COMPILE);
        for (TexturedPolygon poly : faces) {
            poly.draw(scale);//from   w  w w. j av a 2  s  . c  o  m
        }
        GL11.glEndList();
    } else {
        for (TexturedPolygon poly : faces) {
            poly.draw(scale);
        }
    }
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCelestialCrystals.java

License:Open Source License

private void renderCelestialCrystals(int stage) {
    GL11.glPushMatrix();/*  w w  w. j a v  a2 s . c  o m*/
    texCelestialCrystals.bind();
    int dlSelected;
    WavefrontObject obj;
    switch (stage) {
    case 0:
        dlSelected = dlC0;
        obj = OBJModelLibrary.crystalsStage0;
        break;
    case 1:
        dlSelected = dlC1;
        obj = OBJModelLibrary.crystalsStage1;
        break;
    case 2:
        dlSelected = dlC2;
        obj = OBJModelLibrary.crystalsStage2;
        break;
    case 3:
        dlSelected = dlC3;
        obj = OBJModelLibrary.crystalsStage3;
        break;
    case 4:
        dlSelected = dlC4;
        obj = OBJModelLibrary.crystalsStage4;
        break;
    default:
        dlSelected = dlC0;
        obj = OBJModelLibrary.crystalsStage0;
        break;
    }
    if (dlSelected == -1) {
        dlSelected = GLAllocation.generateDisplayLists(1);
        switch (stage) {
        case 0:
            dlC0 = dlSelected;
            break;
        case 1:
            dlC1 = dlSelected;
            break;
        case 2:
            dlC2 = dlSelected;
            break;
        case 3:
            dlC3 = dlSelected;
            break;
        case 4:
            dlC4 = dlSelected;
            break;
        default:
            dlC0 = dlSelected;
            break;
        }
        GL11.glNewList(dlSelected, GL11.GL_COMPILE);
        obj.renderAll(true);
        GL11.glEndList();
    }
    GL11.glCallList(dlSelected);

    GL11.glPopMatrix();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRCollectorCrystal.java

License:Open Source License

private static void renderTile(BindableResource tex) {
    GL11.glPushMatrix();//w  ww.  j a  v  a  2s.  c  o  m
    GL11.glScalef(0.13F, 0.13F, 0.13F);
    tex.bind();
    if (dlCrystal == -1) {
        dlCrystal = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(dlCrystal, GL11.GL_COMPILE);
        OBJModelLibrary.bigCrystal.renderAll(true);
        GL11.glEndList();
    }
    GL11.glCallList(dlCrystal);

    GL11.glPopMatrix();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRTranslucentBlock.java

License:Open Source License

private static void batchBlocks() {
    World w = Minecraft.getMinecraft().world;
    batchDList = GLAllocation.generateDisplayLists(1);
    GL11.glEnable(GL11.GL_BLEND);//w  w w  .  ja  v  a2  s .  com
    Blending.ADDITIVEDARK.apply();
    GL11.glNewList(batchDList, GL11.GL_COMPILE);
    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();
    vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    for (TranslucentBlockState tbs : blocks) {
        Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(tbs.state, tbs.pos, w, vb);
    }
    tes.draw();
    GL11.glEndList();
    Blending.DEFAULT.apply();
}

From source file:hellfirepvp.astralsorcery.client.sky.RenderDefaultSkybox.java

License:Open Source License

private static void setupSky2(net.minecraft.client.renderer.VertexBuffer vb) {
    if (sky2VBO != null)
        sky2VBO.deleteGlBuffers();/*from  w  ww.  j  a  v  a 2s. c om*/

    if (glSkyList2 >= 0) {
        GLAllocation.deleteDisplayLists(glSkyList2);
        glSkyList2 = -1;
    }

    if (OpenGlHelper.useVbo()) {
        sky2VBO = new VertexBuffer(vertexBufferFormat);
        setupSkyVertices(vb, -16.0F, true);
        vb.finishDrawing();
        vb.reset();
        sky2VBO.bufferData(vb.getByteBuffer());
    } else {
        glSkyList2 = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(glSkyList2, GL11.GL_COMPILE);
        setupSkyVertices(vb, -16.0F, true);
        Tessellator.getInstance().draw();
        GL11.glEndList();
    }
}

From source file:hellfirepvp.astralsorcery.client.sky.RenderDefaultSkybox.java

License:Open Source License

private static void setupSky1(net.minecraft.client.renderer.VertexBuffer vb) {
    if (skyVBO != null)
        skyVBO.deleteGlBuffers();/*  w w w .j a  v  a2 s.co  m*/

    if (glSkyList >= 0) {
        GLAllocation.deleteDisplayLists(glSkyList);
        glSkyList = -1;
    }

    if (OpenGlHelper.useVbo()) {
        skyVBO = new VertexBuffer(vertexBufferFormat);
        setupSkyVertices(vb, 16.0F, false);
        vb.finishDrawing();
        vb.reset();
        skyVBO.bufferData(vb.getByteBuffer());
    } else {
        glSkyList = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(glSkyList, GL11.GL_COMPILE);
        setupSkyVertices(vb, 16.0F, false);
        Tessellator.getInstance().draw();
        GL11.glEndList();
    }
}

From source file:hellfirepvp.astralsorcery.client.sky.RenderDefaultSkybox.java

License:Open Source License

private static void setupStars(net.minecraft.client.renderer.VertexBuffer vb) {
    if (starVBO != null)
        starVBO.deleteGlBuffers();/* ww w.  j ava  2s.co m*/

    if (starGLCallList >= 0) {
        GLAllocation.deleteDisplayLists(starGLCallList);
        starGLCallList = -1;
    }

    if (OpenGlHelper.useVbo()) {
        starVBO = new VertexBuffer(vertexBufferFormat);
        setupStarVertices(vb);
        vb.finishDrawing();
        vb.reset();
        starVBO.bufferData(vb.getByteBuffer());
    } else {
        starGLCallList = GLAllocation.generateDisplayLists(1);
        GlStateManager.pushMatrix();
        GL11.glNewList(starGLCallList, GL11.GL_COMPILE);
        setupStarVertices(vb);
        Tessellator.getInstance().draw();
        GL11.glEndList();
        GlStateManager.popMatrix();
    }
}