List of usage examples for org.lwjgl.opengl GL11 glEndList
public static native void glEndList();
From source file:adrianton.gloptat.plotter.Box.java
License:Open Source License
static void assemble() { handle = GL11.glGenLists(1);//from www. ja v a 2 s .c om GL11.glNewList(handle, GL11.GL_COMPILE); GL11.glLineWidth(3); GL11.glColor3f(1f, 1f, 1f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(-1, -1, 1); GL11.glVertex3d(1, -1, 1); GL11.glVertex3d(1, -1, 1); GL11.glVertex3d(1, 1, 1); GL11.glVertex3d(1, 1, 1); GL11.glVertex3d(-1, 1, 1); GL11.glVertex3d(-1, 1, 1); GL11.glVertex3d(-1, -1, 1); GL11.glVertex3d(-1, -1, -1); GL11.glVertex3d(1, -1, -1); GL11.glVertex3d(1, -1, -1); GL11.glVertex3d(1, 1, -1); GL11.glVertex3d(1, 1, -1); GL11.glVertex3d(-1, 1, -1); GL11.glVertex3d(-1, 1, -1); GL11.glVertex3d(-1, -1, -1); GL11.glVertex3d(-1, -1, -1); GL11.glVertex3d(-1, -1, 1); GL11.glVertex3d(1, -1, -1); GL11.glVertex3d(1, -1, 1); GL11.glVertex3d(1, 1, -1); GL11.glVertex3d(1, 1, 1); GL11.glVertex3d(-1, 1, -1); GL11.glVertex3d(-1, 1, 1); GL11.glEnd(); GL11.glEndList(); }
From source file:adrianton.gloptat.plotter.Pointer.java
License:Open Source License
static void assemble() { final float tmpm = 1; final float tmpm2 = 1 / 3; final float tmpm3 = 7; handle = GL11.glGenLists(1);/* www . j ava 2 s . co m*/ GL11.glNewList(handle, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_TRIANGLES); GL11.glColor3f(1, 1, 1); GL11.glVertex3f(0, 0, tmpm2); GL11.glVertex3f(-tmpm, -tmpm, tmpm3); GL11.glVertex3f(-tmpm, tmpm, tmpm3); GL11.glVertex3f(0, 0, tmpm2); GL11.glVertex3f(-tmpm, tmpm, tmpm3); GL11.glVertex3f(tmpm, tmpm, tmpm3); GL11.glVertex3f(0, 0, tmpm2); GL11.glVertex3f(tmpm, tmpm, tmpm3); GL11.glVertex3f(tmpm, -tmpm, tmpm3); GL11.glVertex3f(0, 0, tmpm2); GL11.glVertex3f(tmpm, -tmpm, tmpm3); GL11.glVertex3f(-tmpm, -tmpm, tmpm3); GL11.glEnd(); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(tmpm, tmpm, tmpm3); GL11.glVertex3f(tmpm, -tmpm, tmpm3); GL11.glVertex3f(-tmpm, -tmpm, tmpm3); GL11.glVertex3f(-tmpm, tmpm, tmpm3); GL11.glEnd(); GL11.glEndList(); }
From source file:adrianton.gloptat.plotter.Surface.java
License:Open Source License
public static void assemble(Displayer outer) { int i, j;//from w w w. j a v a 2 s . c o m float px, py; float z1, z2, z3, z4; float tmp; Color col; float spx = -outer.rezx / 2; float spy = -outer.rezy / 2; handle = GL11.glGenLists(1); GL11.glNewList(handle, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); px = spx; for (i = 0; i < outer.rezx - 1; i++) { py = spy; for (j = 0; j < outer.rezy - 1; j++) { z1 = (float) outer.val[i][j]; z2 = (float) outer.val[i + 1][j]; z3 = (float) outer.val[i][j + 1]; z4 = (float) outer.val[i + 1][j + 1]; tmp = (float) (1 - ((outer.val[i][j] - outer.minc) / (outer.maxc - outer.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.glVertex3f(px, py, z1); tmp = (float) (1 - ((outer.val[i][j + 1] - outer.minc) / (outer.maxc - outer.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.glVertex3f(px, py + 1, z3); tmp = (float) (1 - ((outer.val[i + 1][j + 1] - outer.minc) / (outer.maxc - outer.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.glVertex3f(px + 1, py + 1, z4); tmp = (float) (1 - ((outer.val[i + 1][j] - outer.minc) / (outer.maxc - outer.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.glVertex3f(px + 1, py, z2); py += 1; } px += 1; } GL11.glEnd(); GL11.glEndList(); }
From source file:akarnokd.opengl.experiment.Planet.java
License:Apache License
public static Planet create(String file, float radius, int smoothness) { Planet p = new Planet(); p.id = ObjectTracker.add(p);//from w w w .ja v a2 s . c om p.radius = radius; p.smoothness = smoothness; // GLU sphere requires a mirrored texture ?! p.tex = Texture.fromFile(file, false, true); { Sphere sphere = new Sphere(); sphere.setDrawStyle(GLU.GLU_FILL); sphere.setTextureFlag(true); sphere.setNormals(GLU.GLU_SMOOTH); sphere.setOrientation(GLU.GLU_OUTSIDE); p.handle = GL11.glGenLists(1); GL11.glNewList(p.handle, GL11.GL_COMPILE); p.tex.use(); GL11.glColor4f(1, 1, 1, 1); sphere.draw(radius, smoothness, smoothness); p.tex.stop(); GL11.glEndList(); } { Sphere sphere2 = new Sphere(); sphere2.setDrawStyle(GLU.GLU_FILL); sphere2.setNormals(GLU.GLU_SMOOTH); sphere2.setOrientation(GLU.GLU_OUTSIDE); p.handleSelect = GL11.glGenLists(1); GL11.glNewList(p.handleSelect, GL11.GL_COMPILE); G2D.color(p.id); sphere2.draw(radius, smoothness, smoothness); GL11.glEndList(); } { Sphere sphere2 = new Sphere(); sphere2.setDrawStyle(GLU.GLU_LINE); sphere2.setNormals(GLU.GLU_NONE); p.wireframe = GL11.glGenLists(1); GL11.glNewList(p.wireframe, GL11.GL_COMPILE); sphere2.draw(radius, smoothness, smoothness); GL11.glEndList(); } return p; }
From source file:appeng.client.render.blocks.RenderBlockCraftingCPUMonitor.java
License:Open Source License
@Override public void renderTile(final BlockCraftingMonitor block, final TileCraftingMonitorTile tile, final Tessellator tess, final double x, final double y, final double z, final float f, final RenderBlocks renderer) { if (tile != null) { final IAEItemStack ais = tile.getJobProgress(); if (tile.getDisplayList() == null) { tile.setUpdateList(true);//from www .ja v a 2 s . c om tile.setDisplayList(GLAllocation.generateDisplayLists(1)); } if (ais != null) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); if (tile.isUpdateList()) { tile.setUpdateList(false); GL11.glNewList(tile.getDisplayList(), GL11.GL_COMPILE_AND_EXECUTE); this.tesrRenderScreen(tess, tile, ais); GL11.glEndList(); } else { GL11.glCallList(tile.getDisplayList()); } GL11.glPopMatrix(); } } }
From source file:appeng.parts.reporting.AbstractPartMonitor.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)/*from w w w . j ava 2 s . c o m*/ public void renderDynamic(final double x, final double y, final double z, final IPartRenderHelper rh, final RenderBlocks renderer) { if (this.dspList == null) { this.dspList = GLAllocation.generateDisplayLists(1); } final Tessellator tess = Tessellator.instance; if ((this.getClientFlags() & (PartPanel.POWERED_FLAG | PartPanel.CHANNEL_FLAG)) != (PartPanel.POWERED_FLAG | PartPanel.CHANNEL_FLAG)) { return; } final IAEItemStack ais = (IAEItemStack) this.getDisplayed(); if (ais != null) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); if (this.updateList) { this.updateList = false; GL11.glNewList(this.dspList, GL11.GL_COMPILE_AND_EXECUTE); this.tesrRenderScreen(tess, ais); GL11.glEndList(); } else { GL11.glCallList(this.dspList); } GL11.glPopMatrix(); } }
From source file:appeng.parts.reporting.PartStorageMonitor.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)//from ww w .j av a 2 s. c o m public void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer) { if (this.dspList == null) { this.dspList = GLAllocation.generateDisplayLists(1); } Tessellator tess = Tessellator.instance; if ((this.clientFlags & (this.POWERED_FLAG | this.CHANNEL_FLAG)) != (this.POWERED_FLAG | this.CHANNEL_FLAG)) { return; } IAEItemStack ais = (IAEItemStack) this.getDisplayed(); if (ais != null) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); if (this.updateList) { this.updateList = false; GL11.glNewList(this.dspList, GL11.GL_COMPILE_AND_EXECUTE); this.tesrRenderScreen(tess, ais); GL11.glEndList(); } else { GL11.glCallList(this.dspList); } GL11.glPopMatrix(); } }
From source file:buildcraft.core.lib.client.render.FluidRenderer.java
License:Minecraft Mod Public
/** Note that this does NOT implement caching. */ public static int[] getFluidDisplayListForSide(FluidStack fluidStack, FluidType type, Vec3d size, EnumFacing side) {//w w w . ja v a 2 s . com if (fluidStack == null) { return null; } Fluid fluid = fluidStack.getFluid(); if (fluid == null) { return null; } int[] lists = new int[DISPLAY_STAGES]; for (int s = 0; s < DISPLAY_STAGES; ++s) { lists[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(lists[s], GL11.GL_COMPILE); EntityResizableCuboid ent = new EntityResizableCuboid(null); ent.xSize = size.xCoord; ent.ySize = (Math.max(s, 1) / (float) DISPLAY_STAGES) * size.yCoord; ent.zSize = size.zCoord; ent.texture = getFluidTexture(fluidStack, type); ent.makeClient(); Arrays.fill(ent.textures, null); ent.textures[side.ordinal()] = ent.texture; RenderResizableCuboid.INSTANCE.renderCube(ent); GL11.glEndList(); } return lists; }
From source file:buildcraft.core.lib.client.render.FluidRenderer.java
License:Minecraft Mod Public
public static int[] getFluidDisplayLists(FluidStack fluidStack, FluidType type, Vec3d size) { if (fluidStack == null) { return null; }/*from w ww .ja v a 2s. co m*/ Fluid fluid = fluidStack.getFluid(); if (fluid == null) { return null; } Map<Fluid, Map<Vec3d, int[]>> cache = type == FluidType.FLOWING ? INSTANCE.flowingRenderCache : (type == FluidType.STILL ? INSTANCE.stillRenderCache : INSTANCE.frozenRenderCache); Map<Vec3d, int[]> displayLists = cache.get(fluid); int[] displayList; if (displayLists != null) { displayList = displayLists.get(size); if (displayList != null) { return displayList; } } else { displayLists = Maps.newHashMap(); cache.put(fluid, displayLists); } displayList = new int[DISPLAY_STAGES]; cache.put(fluid, displayLists); for (int s = 0; s < DISPLAY_STAGES; ++s) { displayList[s] = GLAllocation.generateDisplayLists(1); GL11.glNewList(displayList[s], GL11.GL_COMPILE); EntityResizableCuboid ent = new EntityResizableCuboid(null); ent.xSize = size.xCoord; ent.ySize = (Math.max(s, 1) / (float) DISPLAY_STAGES) * size.yCoord; ent.zSize = size.zCoord; ent.texture = getFluidTexture(fluidStack, type); RenderResizableCuboid.INSTANCE.renderCube(ent, true, false); GL11.glEndList(); } displayLists.put(size, displayList); return displayList; }
From source file:buildcraft.core.lib.render.FluidRenderer.java
License:Minecraft Mod Public
public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) { if (fluidStack == null) { return null; }//w w w . ja v a 2 s.com 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 = 0.01f; liquidBlock.minY = 0; liquidBlock.minZ = 0.01f; liquidBlock.maxX = 0.99f; liquidBlock.maxY = Math.max(s, 1) / (float) DISPLAY_STAGES; liquidBlock.maxZ = 0.99f; 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; }