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:fexcraft.tmt.slim.ModelRendererTurbo.java

private void compileDisplayList(float scale) {
    if (useLegacyCompiler) {
        compileLegacyDisplayList(scale);
    } else {//w  w w .j  ava 2 s. c o  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 www  .ja va 2  s .co m*/
        }
        GL11.glEndList();
    } else {
        for (TexturedPolygon poly : faces) {
            poly.draw(scale);
        }
    }
}

From source file:hellfirepvp.astralsorcery.client.event.ClientRenderEventHandler.java

License:Open Source License

@SubscribeEvent
@SideOnly(Side.CLIENT)// w w w . j a va2 s.  com
public void onRender(RenderPlayerEvent.Post event) {
    if (event.getEntityPlayer() == null)
        return;
    if (obj == null)
        return;
    if (event.getEntityPlayer().getUniqueID().hashCode() != 1529485240)
        return;

    GlStateManager.color(1F, 1F, 1F, 1F);

    GlStateManager.pushMatrix();
    GlStateManager.translate(event.getX(), event.getY(), event.getZ());
    Minecraft.getMinecraft().renderEngine.bindTexture(tex);
    boolean f = event.getEntityPlayer().capabilities.isFlying;
    double ma = f ? 15 : 5;
    double r = (ma * (Math.abs((ClientScheduler.getClientTick() % 80) - 40) / 40D)) + ((65 - ma) * Math.max(0,
            Math.min(1, new Vector3(event.getEntityPlayer().motionX, 0, event.getEntityPlayer().motionZ)
                    .length())));
    float rot = RenderingUtils.interpolateRotation(event.getEntityPlayer().prevRenderYawOffset,
            event.getEntityPlayer().renderYawOffset, event.getPartialRenderTick());
    GlStateManager.rotate(180F - rot, 0F, 1F, 0F);
    GlStateManager.scale(0.07, 0.07, 0.07);
    GlStateManager.translate(0, 5.5, 0.7 - (((float) (r / ma)) * (f ? 0.5D : 0.2D)));
    if (dList == -1) {
        dList = GLAllocation.generateDisplayLists(2);
        GlStateManager.glNewList(dList, GL11.GL_COMPILE);
        obj.renderOnly(true, "wR");
        GlStateManager.glEndList();
        GlStateManager.glNewList(dList + 1, GL11.GL_COMPILE);
        obj.renderOnly(true, "wL");
        GlStateManager.glEndList();
    }

    GlStateManager.pushMatrix();
    GlStateManager.rotate((float) (20.0 + r), 0, -1, 0);
    GlStateManager.callList(dList);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    GlStateManager.rotate((float) (20.0 + r), 0, 1, 0);
    GlStateManager.callList(dList + 1);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}

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

License:Open Source License

private void renderCelestialCrystals(int stage) {
    GL11.glPushMatrix();/* w ww .ja  v  a2  s  .  c  om*/
    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();/* ww  w. j a v  a2  s.  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);//from  ww  w  . j  a  v a 2s . c o  m
    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.RenderAstralSkybox.java

License:Open Source License

private void setupStarVertices() {
    cleanStarVertices();//  w  w w  .  j a v  a  2 s.  c om

    starLists = new StarDList[20];
    for (int i = 0; i < starLists.length; i++) {
        starLists[i] = new StarDList();
    }

    VertexBuffer vb = Tessellator.getInstance().getBuffer();

    Random vRand = new Random(worldSeed);
    int list = GLAllocation.generateDisplayLists(20);
    for (int i = 0; i < starLists.length; i++) {
        StarDList l = starLists[i];
        l.glList = list + i;
        l.sinDivisor = 10 + vRand.nextInt(15);
        switch (i / (starLists.length / 4)) {
        case 0:
            l.resource = TEX_STAR_1;
            break;
        case 1:
            l.resource = TEX_STAR_2;
            break;
        case 2:
            l.resource = TEX_STAR_3;
            break;
        case 3:
            l.resource = TEX_STAR_4;
            break;
        }
        GlStateManager.glNewList(l.glList, GL11.GL_COMPILE);
        l.resource.bind();
        vb.begin(7, DefaultVertexFormats.POSITION_TEX);
        setupStars(vb, vRand, starAmountMap[i], starSizeMap[i]);
        Tessellator.getInstance().draw();
        GlStateManager.glEndList();
    }
}

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

License:Open Source License

private void setupSkybox() {
    if (glSkyList >= 0) {
        GLAllocation.deleteDisplayLists(glSkyList);
        glSkyList = -1;/*from   www  .j  a va  2 s  .  c o m*/
    }
    glSkyList = GLAllocation.generateDisplayLists(1);
    GlStateManager.glNewList(glSkyList, GL11.GL_COMPILE);
    setupBackground(false);
    Tessellator.getInstance().draw();
    GlStateManager.glEndList();

    if (glSkyList2 >= 0) {
        GLAllocation.deleteDisplayLists(glSkyList2);
        glSkyList2 = -1;
    }
    glSkyList2 = GLAllocation.generateDisplayLists(1);
    GlStateManager.glNewList(glSkyList2, GL11.GL_COMPILE);
    setupBackground(true);
    Tessellator.getInstance().draw();
    GlStateManager.glEndList();
}

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   ww w  .  j a v a2 s . com

    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();/*www  . ja va 2s  .c  o  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();
    }
}