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:stevekung.mods.moreplanets.planets.venus.dimension.sky.SkyProviderVenus.java

License:Creative Commons License

public SkyProviderVenus(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 w  w  w .j a  v  a 2s . c  om*/
    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:valkyrienwarfare.mod.client.render.FastBlockModelRenderer.java

License:Open Source License

private static void renderBlockModelHighQualityHighRam(BufferBuilder BufferBuilder, Tessellator tessellator,
        World world, IBlockState blockstateToRender, int brightness) {
    Map<Integer, Integer> brightnessToGLListMap = highRamGLList.get(blockstateToRender);

    if (brightnessToGLListMap == null) {
        highRamGLList.put(blockstateToRender, new HashMap<Integer, Integer>());
        brightnessToGLListMap = highRamGLList.get(blockstateToRender);
    }//from   w w w  . j  a  v a  2  s . c  om

    Integer glListForBrightness = brightnessToGLListMap.get(brightness);
    if (glListForBrightness == null) {
        GL11.glPushMatrix();
        int glList = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(glList, GL11.GL_COMPILE);
        renderBlockModelHighQuality(BufferBuilder, tessellator, world, blockstateToRender, brightness);
        GL11.glEndList();
        GL11.glPopMatrix();
        glListForBrightness = glList;
        brightnessToGLListMap.put(brightness, glList);
    }

    GL11.glPushMatrix();
    GL11.glCallList(glListForBrightness);
    GL11.glPopMatrix();
}

From source file:yk.myengine.optiseq.states.LWJGLFont.java

/**
 * <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  ava  2s.co  m*/
 */
public void buildDisplayList() {
    final int displacement = 10;
    final int symbolWidth = 16;
    final int symbolHeight = 16;
    final int symbolNumX = 16;
    final int symbolNumY = 16;
    final int symbolNumber = 256;
    float cx;
    float cy;
    final float texSymSizeX = (float) 1 / symbolNumX;
    final float texSymSizeY = (float) 1 / symbolNumY;
    base = GL11.glGenLists(symbolNumber);
    final float addDisY = texSymSizeY / 100;

    for (int loop = 0; loop < symbolNumber; loop++) {
        cx = (loop % symbolNumX) * texSymSizeX;
        cy = (loop / symbolNumY) * texSymSizeX;

        GL11.glNewList(base + loop, GL11.GL_COMPILE);
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(cx, 1 - cy - addDisY);
        GL11.glVertex2i(0, symbolHeight);

        GL11.glTexCoord2f(cx, 1 - cy - texSymSizeY + addDisY);
        GL11.glVertex2i(0, 0);

        GL11.glTexCoord2f(cx + texSymSizeX, 1 - cy - texSymSizeY + addDisY);
        GL11.glVertex2i(symbolWidth, 0);

        GL11.glTexCoord2f(cx + texSymSizeX, 1 - cy - addDisY);
        GL11.glVertex2i(symbolWidth, symbolHeight);

        GL11.glEnd();
        GL11.glTranslatef(displacement, 0, 0);
        GL11.glEndList();
    }
}