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:buildcraft.transport.RenderPipe.java
License:Minecraft Mod Public
private void initializeDisplayPowerList(World world) { if (initialized) return;/*w w w . j a v a2s.c om*/ initialized = true; BlockInterface block = new BlockInterface(); block.texture = 0 * 16 + 4; float size = Utils.pipeMaxPos - Utils.pipeMinPos; for (int s = 0; s < displayPowerStages; ++s) { displayPowerList[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(displayPowerList[s], 4864 /* GL_COMPILE */); float minSize = 0.005F; float unit = (size - minSize) / 2F / displayPowerStages; block.minY = 0.5 - (minSize / 2F) - unit * s; block.maxY = 0.5 + (minSize / 2F) + unit * s; block.minZ = 0.5 - (minSize / 2F) - unit * s; block.maxZ = 0.5 + (minSize / 2F) + unit * s; block.minX = 0; block.maxX = 0.5 + (minSize / 2F) + unit * s; RenderEntityBlock.renderBlock(block, world, 0, 0, 0, false, true); GL11.glEndList(); } for (int i = 0; i < displayPowerStages; ++i) displayPowerLimits[displayPowerStages - i - 1] = maxPower - Math.sqrt(maxPower * maxPower / (displayPowerStages - 1) * i); }
From source file:cn.lambdalib.util.deprecated.Mesh.java
License:MIT License
private void redraw(Material mat, boolean execute) { if (doesBuffer) { if (listID == -1) { listID = GL11.glGenLists(1); GL11.glNewList(listID, execute ? GL11.GL_COMPILE_AND_EXECUTE : GL11.GL_COMPILE); }//from w w w. j a v a 2 s . c o m } mat.onRenderStage(RenderStage.START); GL11.glPushMatrix(); mat.onRenderStage(RenderStage.BEFORE_TESSELLATE); Tessellator t = Tessellator.instance; t.startDrawing(GL11.GL_TRIANGLES); mat.onRenderStage(RenderStage.START_TESSELLATE); if (uvs != null) { if (triangles != null) { for (int i : triangles) { double[] vert = vertices[i]; double[] uv = uvs[i]; if (normals != null) { t.setNormal(normals[i][0], normals[i][1], normals[i][2]); } t.addVertexWithUV(vert[0], vert[1], vert[2], uv[0], uv[1]); } } } else { if (triangles != null) { for (int i : triangles) { double[] vert = vertices[i]; if (normals != null) { t.setNormal(normals[i][0], normals[i][1], normals[i][2]); } t.addVertex(vert[0], vert[1], vert[2]); } } } t.draw(); GL11.glPopMatrix(); mat.onRenderStage(RenderStage.END); for (Mesh m : this.sub) { m.draw(mat); } if (doesBuffer) { GL11.glEndList(); } }
From source file:com.ardor3d.renderer.lwjgl.LwjglFont.java
License:Open Source License
/** * <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. *///w ww.ja v a 2 s.co m public void buildDisplayList() { float cx; float cy; base = GL11.glGenLists(256); for (int loop = 0; loop < 256; loop++) { cx = (loop % 16) / 16.0f; cy = (loop / 16) / 16.0f; GL11.glNewList(base + loop, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(cx, 1 - cy - 0.0625f); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(cx + 0.0625f, 1 - cy - 0.0625f); GL11.glVertex2i(16, 0); GL11.glTexCoord2f(cx + 0.0625f, 1 - cy); GL11.glVertex2i(16, 16); GL11.glTexCoord2f(cx, 1 - cy); GL11.glVertex2i(0, 16); GL11.glEnd(); GL11.glTranslatef(10, 0, 0); GL11.glEndList(); } }
From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java
License:Open Source License
/** * Start a new display list. All further renderer commands that can be stored in a display list are part of this new * list until {@link #endDisplayList()} is called. * //from ww w. j a va2 s.c o m * @return id of new display list */ public int startDisplayList() { final int id = GL11.glGenLists(1); GL11.glNewList(id, GL11.GL_COMPILE); return id; }
From source file:com.blogspot.jabelarminecraft.blocksmith.proxy.ClientProxy.java
License:Open Source License
public void createSphereCallList() { Sphere sphere = new Sphere(); //GLU_POINT will render it as dots. //GLU_LINE will render as wireframe //GLU_SILHOUETTE will render as ?shadowed? wireframe //GLU_FILL as a solid. sphere.setDrawStyle(GLU.GLU_FILL);/*from ww w .java 2 s. com*/ //GLU_SMOOTH will try to smoothly apply lighting //GLU_FLAT will have a solid brightness per face, and will not shade. //GLU_NONE will be completely solid, and probably will have no depth to it's appearance. sphere.setNormals(GLU.GLU_SMOOTH); //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered) sphere.setOrientation(GLU.GLU_OUTSIDE); sphereIdOutside = GL11.glGenLists(1); //Create a new list to hold our sphere data. GL11.glNewList(sphereIdOutside, GL11.GL_COMPILE); //binds the texture ResourceLocation rL = new ResourceLocation(BlockSmith.MODID + ":textures/entities/sphere.png"); Minecraft.getMinecraft().getTextureManager().bindTexture(rL); //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s sphere.draw(0.5F, 32, 32); GL11.glEndList(); //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered) sphere.setOrientation(GLU.GLU_INSIDE); sphereIdInside = GL11.glGenLists(1); //Create a new list to hold our sphere data. GL11.glNewList(sphereIdInside, GL11.GL_COMPILE); Minecraft.getMinecraft().getTextureManager().bindTexture(rL); //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s sphere.draw(0.5F, 32, 32); GL11.glEndList(); }
From source file:com.blogspot.jabelarminecraft.magicbeans.proxy.ClientProxy.java
License:Open Source License
public void createSphereCallList() { Sphere sphere = new Sphere(); //GLU_POINT will render it as dots. //GLU_LINE will render as wireframe //GLU_SILHOUETTE will render as ?shadowed? wireframe //GLU_FILL as a solid. sphere.setDrawStyle(GLU.GLU_FILL);/*from w ww . ja v a 2 s . c o m*/ //GLU_SMOOTH will try to smoothly apply lighting //GLU_FLAT will have a solid brightness per face, and will not shade. //GLU_NONE will be completely solid, and probably will have no depth to it's appearance. sphere.setNormals(GLU.GLU_SMOOTH); //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered) sphere.setOrientation(GLU.GLU_OUTSIDE); sphereIdOutside = GL11.glGenLists(1); //Create a new list to hold our sphere data. GL11.glNewList(sphereIdOutside, GL11.GL_COMPILE); //binds the texture ResourceLocation rL = new ResourceLocation(MagicBeans.MODID + ":textures/entities/sphere.png"); Minecraft.getMinecraft().getTextureManager().bindTexture(rL); //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s sphere.draw(0.5F, 32, 32); GL11.glEndList(); //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered) sphere.setOrientation(GLU.GLU_INSIDE); sphereIdInside = GL11.glGenLists(1); //Create a new list to hold our sphere data. GL11.glNewList(sphereIdInside, GL11.GL_COMPILE); Minecraft.getMinecraft().getTextureManager().bindTexture(rL); //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s sphere.draw(0.5F, 32, 32); GL11.glEndList(); }
From source file:com.blogspot.jabelarminecraft.movinglightsource.proxy.ClientProxy.java
License:Open Source License
public void createSphereCallList() { Sphere sphere = new Sphere(); //GLU_POINT will render it as dots. //GLU_LINE will render as wireframe //GLU_SILHOUETTE will render as ?shadowed? wireframe //GLU_FILL as a solid. sphere.setDrawStyle(GLU.GLU_FILL);/* w ww .j a va2 s . c o m*/ //GLU_SMOOTH will try to smoothly apply lighting //GLU_FLAT will have a solid brightness per face, and will not shade. //GLU_NONE will be completely solid, and probably will have no depth to it's appearance. sphere.setNormals(GLU.GLU_SMOOTH); //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered) sphere.setOrientation(GLU.GLU_OUTSIDE); sphereIdOutside = GL11.glGenLists(1); //Create a new list to hold our sphere data. GL11.glNewList(sphereIdOutside, GL11.GL_COMPILE); //binds the texture ResourceLocation rL = new ResourceLocation(MovingLightSource.MODID + ":textures/entities/sphere.png"); Minecraft.getMinecraft().getTextureManager().bindTexture(rL); //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s sphere.draw(0.5F, 32, 32); GL11.glEndList(); //GLU_INSIDE will render as if you are inside the sphere, making it appear inside out.(Similar to how ender portals are rendered) sphere.setOrientation(GLU.GLU_INSIDE); sphereIdInside = GL11.glGenLists(1); //Create a new list to hold our sphere data. GL11.glNewList(sphereIdInside, GL11.GL_COMPILE); Minecraft.getMinecraft().getTextureManager().bindTexture(rL); //The drawing the sphere is automatically doing is getting added to our list. Careful, the last 2 variables //control the detail, but have a massive impact on performance. 32x32 is a good balance on my machine.s sphere.draw(0.5F, 32, 32); GL11.glEndList(); }
From source file:com.blogspot.jabelarminecraft.wildanimals.models.ModelRendererWildAnimals.java
License:Open Source License
/** * Compiles a GL display list for this model */// ww w. j av a2 s .c om @SideOnly(Side.CLIENT) private void compileDisplayList(float par1) { this.displayList = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.displayList, GL11.GL_COMPILE); Tessellator tessellator = Tessellator.instance; for (int i = 0; i < this.cubeList.size(); ++i) { ((ModelBoxWildAnimals) this.cubeList.get(i)).render(tessellator, par1); } GL11.glEndList(); this.compiled = true; }
From source file:com.CiD.MysteryMod.TecEvolution.Buildcraft.FluidRenderer.java
License:Minecraft Mod Public
public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) { if (fluidStack == null) { return null; }//ww w.ja v a 2 s . co m 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]; if (fluid.getBlock() != null) { liquidBlock.baseBlock = fluid.getBlock(); liquidBlock.texture = getFluidTexture(fluidStack, flowing); } else { liquidBlock.baseBlock = Blocks.water; liquidBlock.texture = getFluidTexture(fluidStack, flowing); } cache.put(fluid, diplayLists); 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 = 0f; liquidBlock.minY = 0; liquidBlock.minZ = 0; liquidBlock.maxX = 1f; liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES; liquidBlock.maxZ = 1; RenderEntityBlock.INSTANCE.renderBlock(liquidBlock); GL11.glEndList(); } GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); return diplayLists; }
From source file:com.github.begla.blockmania.rendering.helper.Primitives.java
License:Apache License
public static int generateColoredBlock(Vector4f color, float size) { int id = glGenLists(1); GL11.glNewList(id, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS);/*w w w . j a va 2 s. co m*/ GL11.glColor4f(color.x, color.y, color.z, color.w); float sHalf = size / 2; // TOP GL11.glVertex3f(-sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(-sHalf, sHalf, -sHalf); // LEFT GL11.glVertex3f(-sHalf, -sHalf, -sHalf); GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, -sHalf); // RIGHT GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glColor4f(0.85f * color.x, 0.85f * color.y, 0.85f * color.z, color.w); // FRONT GL11.glVertex3f(-sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glVertex3f(-sHalf, -sHalf, -sHalf); // BACK GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, sHalf); // BOTTOM GL11.glVertex3f(-sHalf, -sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glEnd(); GL11.glEndList(); return id; }