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:org.terasology.rendering.particles.BlockParticle.java

License:Apache License

protected void renderParticle() {
    if (_displayLists[_blockType] == 0) {
        _displayLists[_blockType] = glGenLists(1);
        glNewList(_displayLists[_blockType], GL11.GL_COMPILE);
        drawParticle();//ww  w.  ja v a2 s. c o m
        glEndList();
    }

    float lightValue = _parent.getParent().getRenderingLightValueAt(_position);

    // Apply biome and overall color offset
    FloatBuffer colorBuffer = BufferUtils.createFloatBuffer(3);
    Vector4f color = BlockManager.getInstance().getBlock(_blockType).calcColorOffsetFor(Block.SIDE.FRONT,
            _parent.getParent().getActiveTemperature(), _parent.getParent().getActiveHumidity());
    colorBuffer.put(color.x);
    colorBuffer.put(color.y);
    colorBuffer.put(color.z);
    colorBuffer.flip();

    int colorOffset = GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("particle"),
            "colorOffset");
    int light = GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("particle"), "light");
    int texOffsetX = GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("particle"), "texOffsetX");
    int texOffsetY = GL20.glGetUniformLocation(ShaderManager.getInstance().getShader("particle"), "texOffsetY");
    GL20.glUniform1f(light, lightValue * _lightOffset);
    GL20.glUniform1f(texOffsetX, _texOffsetX);
    GL20.glUniform1f(texOffsetY, _texOffsetY);
    GL20.glUniform3(colorOffset, colorBuffer);

    glCallList(_displayLists[_blockType]);
}

From source file:org.terasology.rendering.primitives.LightGeometryHelper.java

License:Apache License

public static void renderSphereGeometry() {
    if (displayListSphere == -1) {
        displayListSphere = glGenLists(1);

        Sphere sphere = new Sphere();

        glNewList(displayListSphere, GL11.GL_COMPILE);

        sphere.draw(1, 8, 8);/*from w  w w .  ja va2 s . c  om*/

        glEndList();
    }

    glCallList(displayListSphere);
}

From source file:org.terasology.rendering.renderer.AABBRenderer.java

License:Apache License

private void generateDisplayListWire() {
    float offset = 0.001f;

    displayListWire = glGenLists(1);//  w  w  w . j  ava2s.  co  m

    glNewList(displayListWire, GL11.GL_COMPILE);
    glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    Vector3f dimensions = aabb.getExtents();

    // FRONT
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, -dimensions.z - offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, -dimensions.z - offset);
    glEnd();

    // BACK
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, +dimensions.z + offset);
    glEnd();

    // TOP
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, +dimensions.z + offset);
    glEnd();

    // BOTTOM
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, +dimensions.z + offset);
    glEnd();

    // LEFT
    glBegin(GL_LINE_LOOP);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(-dimensions.x - offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(-dimensions.x - offset, +dimensions.y + offset, -dimensions.z - offset);
    glEnd();

    // RIGHT
    glBegin(GL_LINE_LOOP);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, -dimensions.z - offset);
    glVertex3f(+dimensions.x + offset, -dimensions.y - offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, +dimensions.z + offset);
    glVertex3f(+dimensions.x + offset, +dimensions.y + offset, -dimensions.z - offset);
    glEnd();
    glEndList();
}

From source file:org.terasology.rendering.world.Skysphere.java

License:Apache License

private void drawSkysphere() {
    if (displayListSphere == -1) {
        displayListSphere = glGenLists(1);

        Sphere sphere = new Sphere();
        sphere.setTextureFlag(true);/*from ww w.  j a v a2  s . c o  m*/

        glNewList(displayListSphere, GL11.GL_COMPILE);

        sphere.draw(1024, 16, 128);

        glEndList();
    }

    glCallList(displayListSphere);
}

From source file:pso.Surface.java

License:Open Source License

public static void assemble(float[][] val, float minc, float maxc, int rezx, int rezy) {
    int i, j;//from   ww  w.j  ava2 s  . com
    float px, py;
    float tmp;

    Color col;

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

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

    GL11.glBegin(GL11.GL_QUADS);

    px = spx;
    for (i = 0; i < rezx - 1; i++) {
        py = spy;
        for (j = 0; j < rezy - 1; j++) {
            tmp = (float) (1 - ((val[i][j] - minc) / (maxc - 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.glVertex2f(px, py);

            tmp = (float) (1 - ((val[i][j + 1] - minc) / (maxc - 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.glVertex2f(px, py + 1);

            tmp = (float) (1 - ((val[i + 1][j + 1] - minc) / (maxc - 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.glVertex2f(px + 1, py + 1);

            tmp = (float) (1 - ((val[i + 1][j] - minc) / (maxc - 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.glVertex2f(px + 1, py);

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

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

From source file:rheel.ac.client.renderer.model.ModelSAPC.java

License:Open Source License

private int setupRenderer() {
    final int id = GL11.glGenLists(1);
    GL11.glNewList(id, GL11.GL_COMPILE);
    this.bottom.render(1);
    this.bottomRight1.render(1);
    this.bottomRight2.render(1);
    this.bottomRight3.render(1);
    this.right.render(1);
    this.topRight1.render(1);
    this.topRight2.render(1);
    this.topRight3.render(1);
    this.top.render(1);
    this.topLeft1.render(1);
    this.topleft2.render(1);
    this.topLeft3.render(1);
    this.left.render(1);
    this.bottomLeft1.render(1);
    this.bottomLeft2.render(1);
    this.bottomLeft3.render(1);
    GL11.glEndList();/* w w  w  .j  a va2 s  . c  o m*/
    return id;
}

From source file:shadowmage.ancient_framework.client.model.Primitive.java

License:Open Source License

public void buildDisplayList() {
    if (this.displayListNumber < 0) {
        this.displayListNumber = GL11.glGenLists(1);
    }/*from   w w  w.j  av  a  2 s . c o  m*/
    GL11.glNewList(displayListNumber, GL11.GL_COMPILE);
    if (x != 0 || y != 0 || z != 0) {
        GL11.glTranslatef(x, y, z);
    }
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }
    renderForDisplayList();
    if (x != 0 || y != 0 || z != 0) {
        GL11.glTranslatef(-x, -y, -z);
    }
    if (rx != 0) {
        GL11.glRotatef(-rx, 1, 0, 0);
    }
    if (ry != 0) {
        GL11.glRotatef(-ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(-rz, 0, 0, 1);
    }
    GL11.glEndList();
    setCompiled(true);
}

From source file:stevekung.mods.moreplanets.core.handler.SkyProviderMarsMP.java

License:Creative Commons License

public SkyProviderMarsMP(IGalacticraftWorldProvider marsProvider) {
    this.sunSize = 17.5F * marsProvider.getSolarSize();

    int displayLists = GLAllocation.generateDisplayLists(3);
    this.starList = displayLists;
    this.glSkyList = displayLists + 1;
    this.glSkyList2 = displayLists + 2;

    // Bind stars to display list
    GL11.glPushMatrix();/*from  www.  j  a va  2s .  co m*/
    GL11.glNewList(this.starList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();

    Tessellator tessellator = Tessellator.instance;
    GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
    byte byte2 = 64;
    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();
    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:stevekung.mods.moreplanets.moons.deimos.dimension.sky.SkyProviderDeimos.java

License:Creative Commons License

public SkyProviderDeimos(IGalacticraftWorldProvider gcProvider) {
    this.sunSize = 17.5F * gcProvider.getSolarSize();

    GL11.glPushMatrix();/*w ww .j  a  v a2s . co m*/
    GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();
    Tessellator tessellator = Tessellator.instance;
    this.glSkyList = this.starGLCallList + 1;
    GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
    byte byte2 = 64;
    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:stevekung.mods.moreplanets.moons.io.dimension.sky.SkyProviderIo.java

License:Creative Commons License

public SkyProviderIo(IGalacticraftWorldProvider provider) {
    int displayLists = GLAllocation.generateDisplayLists(3);
    this.starList = displayLists;
    this.glSkyList = displayLists + 1;
    this.glSkyList2 = displayLists + 2;

    // Bind stars to display list
    GL11.glPushMatrix();//from  w ww.  ja  v  a2s  .  c  o  m
    GL11.glNewList(this.starList, GL11.GL_COMPILE);
    this.renderStars();
    GL11.glEndList();
    GL11.glPopMatrix();

    Tessellator tessellator = Tessellator.instance;
    GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
    byte byte2 = 64;
    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();
    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();
}