List of usage examples for org.lwjgl.opengl GL11 glNewList
public static native void glNewList(@NativeType("GLuint") int n, @NativeType("GLenum") int mode);
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 ww w .j a va2s . 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"); }
From source file:fexcraft.tmt.slim.ModelRendererTurbo.java
private void compileDisplayList(float scale) { if (useLegacyCompiler) { compileLegacyDisplayList(scale); } else {/* ww w .ja v a2 s . c om*/ 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);// w w w. j a va 2 s . co 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();//from www . jav a 2 s .com 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();/*from ww w . j av 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);// www . j a v a 2 s .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.RenderDefaultSkybox.java
License:Open Source License
private static void setupSky2(net.minecraft.client.renderer.VertexBuffer vb) { if (sky2VBO != null) sky2VBO.deleteGlBuffers();//from w w w . ja va 2 s . co m 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();//from www . j av a2 s. com 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();/*from w ww . j a v a2 s .c om*/ 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(); } }
From source file:ihl.model.FluidRenderer.java
License:Open Source License
public static int[] getLiquidDisplayLists(FluidStack fluidStack, boolean flowing) { if (fluidStack == null) return null; Fluid fluid = fluidStack.getFluid(); if (fluid == null) return null; Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache; int[] diplayLists = cache.get(fluid); if (diplayLists != null) return diplayLists; diplayLists = new int[DISPLAY_STAGES]; liquidBlock.texture[0] = null;/*from w ww . java 2 s .com*/ if (fluid.getBlock() != null) { liquidBlock.template = fluid.getBlock(); liquidBlock.texture[0] = getFluidTexture(fluidStack, flowing); } else { liquidBlock.template = Blocks.water; liquidBlock.texture[0] = getFluidTexture(fluidStack, flowing); } GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); for (int s = 0; s < DISPLAY_STAGES; ++s) { diplayLists[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/); liquidBlock.minX = 0.01f; liquidBlock.minY = 0; liquidBlock.minZ = 0.01f; liquidBlock.maxX = 0.99f; liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES; liquidBlock.maxZ = 0.99f; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); RenderInfo info = liquidBlock; renderBlocks.setRenderBounds(info.minX, info.minY, info.minZ, info.maxX, info.maxY, info.maxZ); if (info.renderSide[0]) renderBlocks.renderFaceYNeg(info.template, 0D, 0D, 0D, info.getBlockTextureFromSide(0)); if (info.renderSide[1]) renderBlocks.renderFaceYPos(info.template, 0D, 0D, 0D, info.getBlockTextureFromSide(1)); if (info.renderSide[2]) renderBlocks.renderFaceZNeg(info.template, 0D, 0D, 0D, info.getBlockTextureFromSide(2)); if (info.renderSide[3]) renderBlocks.renderFaceZPos(info.template, 0D, 0D, 0D, info.getBlockTextureFromSide(3)); if (info.renderSide[4]) renderBlocks.renderFaceXNeg(info.template, 0D, 0D, 0D, info.getBlockTextureFromSide(4)); if (info.renderSide[5]) renderBlocks.renderFaceXPos(info.template, 0D, 0D, 0D, info.getBlockTextureFromSide(5)); tessellator.draw(); GL11.glEndList(); } GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); cache.put(fluid, diplayLists); return diplayLists; }