List of usage examples for org.lwjgl.opengl GL11 GL_COMPILE
int GL_COMPILE
To view the source code for org.lwjgl.opengl GL11 GL_COMPILE.
Click Source Link
From source file:adrianton.gloptat.plotter.Box.java
License:Open Source License
static void assemble() { handle = GL11.glGenLists(1);//from w w w .j a 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);/*from w ww . j a va 2 s .com*/ 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;//w ww . j a va 2 s . c om 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);/*w w w . ja v a2 s.c o m*/ 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.SpatialSkyRender.java
License:Open Source License
@Override public void render(final float partialTicks, final WorldClient world, final Minecraft mc) { final long now = System.currentTimeMillis(); if (now - this.cycle > 2000) { this.cycle = now; GlStateManager.glNewList(this.dspList, GL11.GL_COMPILE); this.renderTwinkles(); GlStateManager.glEndList();/*from w ww . j av a 2 s . c om*/ } float fade = now - this.cycle; fade /= 1000; fade = 0.15f * (1.0f - Math.abs((fade - 1.0f) * (fade - 1.0f))); GlStateManager.disableFog(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.depthMask(false); GlStateManager.color(0.0f, 0.0f, 0.0f, 1.0f); final Tessellator tessellator = Tessellator.getInstance(); final VertexBuffer VertexBuffer = tessellator.getBuffer(); // This renders a skybox around the player at a far, fixed distance from them. // The skybox is pitch black and untextured for (int i = 0; i < 6; ++i) { GlStateManager.pushMatrix(); if (i == 1) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); } if (i == 2) { GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); } if (i == 3) { GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); } if (i == 4) { GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); } if (i == 5) { GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F); } GlStateManager.disableTexture2D(); VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); VertexBuffer.pos(-100.0D, -100.0D, -100.0D).endVertex(); VertexBuffer.pos(-100.0D, -100.0D, 100.0D).endVertex(); VertexBuffer.pos(100.0D, -100.0D, 100.0D).endVertex(); VertexBuffer.pos(100.0D, -100.0D, -100.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); } GlStateManager.depthMask(true); if (fade > 0.0f) { GlStateManager.disableFog(); GlStateManager.disableAlpha(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); RenderHelper.disableStandardItemLighting(); GlStateManager.color(fade, fade, fade, 1.0f); GlStateManager.callList(this.dspList); } GlStateManager.depthMask(true); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableFog(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); }
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) {/*from w w w . j a v a2 s.c o m*/ 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; }// w w w . j a v a2 s . c om 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.render.RenderLaser.java
License:Minecraft Mod Public
private static void initScaledBoxes() { if (scaledBoxes == null) { scaledBoxes = new int[100][20]; for (int size = 0; size < 100; ++size) { for (int i = 0; i < 20; ++i) { scaledBoxes[size][i] = GLAllocation.generateDisplayLists(1); GL11.glNewList(scaledBoxes[size][i], GL11.GL_COMPILE); RenderInfo block = new RenderInfo(); float minSize = 0.2F * size / 100F; float maxSize = 0.4F * size / 100F; //float minSize = 0.1F; //float maxSize = 0.2F; float range = maxSize - minSize; float diff = (float) (Math.cos(i / 20F * 2 * Math.PI) * range / 2F); block.minX = 0.0;// w w w . j a v a 2 s . co m block.minY = -maxSize / 2F + diff; block.minZ = -maxSize / 2F + diff; block.maxX = STEP; block.maxY = maxSize / 2F - diff; block.maxZ = maxSize / 2F - diff; RenderEntityBlock.INSTANCE.renderBlock(block, null, 0, 0, 0, false, true); GL11.glEndList(); } } } }
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 ww. j a va 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 w w . j a v a 2s . c o 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(); } }