List of usage examples for org.lwjgl.opengl GL11 glGenLists
@NativeType("GLuint") public static native int glGenLists(@NativeType("GLsizei") int s);
From source file:rheel.ac.client.renderer.model.ModelSAPC.java
License:Open Source License
private int setupRenderer() { final int id = GL11.glGenLists(1); GL11.glNewList(id, GL11.GL_COMPILE); this.bottom.render(1); this.bottomRight1.render(1); this.bottomRight2.render(1); this.bottomRight3.render(1); this.right.render(1); this.topRight1.render(1); this.topRight2.render(1); this.topRight3.render(1); this.top.render(1); this.topLeft1.render(1); this.topleft2.render(1); this.topLeft3.render(1); this.left.render(1); this.bottomLeft1.render(1); this.bottomLeft2.render(1); this.bottomLeft3.render(1); GL11.glEndList();// w ww.ja va 2s . c o m return id; }
From source file:shadowmage.ancient_framework.client.gui.elements.GuiScrollBarSimple.java
License:Open Source License
@Override public void drawElement(int mouseX, int mouseY) { if (!this.hidden) { String tex = Statics.TEXTURE_PATH + "gui/guiButtons.png"; if (height <= 128)//do simple render {//from w w w. j a v a 2 s. c o m this.drawQuadedTexture(renderPosX + guiLeft, renderPosY + guiTop, width, height, 40, 128, tex, 80, 120); this.drawQuadedTexture(renderPosX + guiLeft + buffer, renderPosY + guiTop + buffer + handleTop, width - buffer * 2, handleHeight, 32, 128, tex, 120, 120); return; } else if (displayListNum > 0) { AWTextureManager.bindTexture(tex); GL11.glCallList(displayListNum); return; } displayListNum = GL11.glGenLists(1); AWTextureManager.bindTexture(tex); GL11.glNewList(displayListNum, GL11.GL_COMPILE_AND_EXECUTE); GL11.glColor4f(1.f, 1.f, 1.f, 1.f); float texPixPercent = 1.f / 256.f; float x, y, u, v, uw, uh, width, height; x = renderPosX + guiLeft; y = renderPosY + guiTop; uw = 40; uh = 128; u = 80; v = 120; width = this.width; height = this.height; float x1, y1, x2, y2, x3, y3, x4, y4; float u1, v1, u2, v2, u3, v3, u4, v4; /** * setup render bounds */ /** * render the top-left bit */ x1 = x;//top-left y1 = y;//top-left x2 = x1;//bottom-left y2 = y1 + 8;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - 8;//top-right u1 = u * texPixPercent; v1 = v * texPixPercent; u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render the top-right bit */ x1 = x + (width / 2);//top-left y1 = y;//top-left x2 = x1;//bottom-left y2 = y1 + 8;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - 8;//top-right u1 = u * texPixPercent + (uw - (width / 2)) * texPixPercent; v1 = v * texPixPercent; u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render bottom-left bit */ x1 = x; y1 = y + height - 8; x2 = x1; y2 = y1 + 8; x3 = x2 + (width / 2); y3 = y2; x4 = x3; y4 = y3 - 8; u1 = u * texPixPercent; v1 = v * texPixPercent + ((uh - 8) * texPixPercent); u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); x1 = x + (width / 2);//top-left y1 = y + height - 8;//top-left x2 = x1;//bottom-left y2 = y1 + 8;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - 8;//top-right u1 = u * texPixPercent + (uw - (width / 2)) * texPixPercent; v1 = v * texPixPercent + ((uh - 8) * texPixPercent); u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); float remainingHeight = height - 16; float nextY = y + 8; float usedHeight; while (remainingHeight > 0) { usedHeight = remainingHeight > 40 ? 40 : remainingHeight; remainingHeight -= usedHeight; /** * render left bit */ x1 = x;//top-left y1 = nextY;//top-left x2 = x1;//bottom-left y2 = y1 + usedHeight;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - usedHeight;//top-right u1 = u * texPixPercent; v1 = v * texPixPercent + (8 * texPixPercent); u2 = u1; v2 = v1 + usedHeight * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - usedHeight * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render right bit */ x1 = x + (width / 2);//top-left y1 = nextY;//top-left x2 = x1;//bottom-left y2 = y1 + usedHeight;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - usedHeight;//top-right u1 = u * texPixPercent + (uw - (width / 2)) * texPixPercent; v1 = v * texPixPercent + (8 * texPixPercent); u2 = u1; v2 = v1 + usedHeight * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - usedHeight * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); nextY += usedHeight; } x = renderPosX + guiLeft + buffer; y = renderPosY + guiTop + buffer + handleTop; u = 120;//uw = 32 v = 120;//uh = 128 uw = 32; uh = 128; width = this.width - (buffer * 2); height = this.handleHeight; /** * render the top-left bit */ x1 = x;//top-left y1 = y;//top-left x2 = x1;//bottom-left y2 = y1 + 8;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - 8;//top-right u1 = u * texPixPercent; v1 = v * texPixPercent; u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render the top-right bit */ x1 = x + (width / 2);//top-left y1 = y;//top-left x2 = x1;//bottom-left y2 = y1 + 8;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - 8;//top-right u1 = u * texPixPercent + (uw - (width / 2)) * texPixPercent; v1 = v * texPixPercent; u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render bottom-left bit */ x1 = x; y1 = y + height - 8; x2 = x1; y2 = y1 + 8; x3 = x2 + (width / 2); y3 = y2; x4 = x3; y4 = y3 - 8; u1 = u * texPixPercent; v1 = v * texPixPercent + ((uh - 8) * texPixPercent); u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render bottom-right bit */ x1 = x + (width / 2);//top-left y1 = y + height - 8;//top-left x2 = x1;//bottom-left y2 = y1 + 8;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - 8;//top-right u1 = u * texPixPercent + (uw - (width / 2)) * texPixPercent; v1 = v * texPixPercent + ((uh - 8) * texPixPercent); u2 = u1; v2 = v1 + 8 * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - 8 * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); remainingHeight = height - 16; nextY = y + 8; while (remainingHeight > 0) { usedHeight = remainingHeight > 40 ? 40 : remainingHeight; remainingHeight -= usedHeight; /** * render left bit */ x1 = x;//top-left y1 = nextY;//top-left x2 = x1;//bottom-left y2 = y1 + usedHeight;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - usedHeight;//top-right u1 = u * texPixPercent; v1 = v * texPixPercent + (8 * texPixPercent); u2 = u1; v2 = v1 + usedHeight * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - usedHeight * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); /** * render right bit */ x1 = x + (width / 2);//top-left y1 = nextY;//top-left x2 = x1;//bottom-left y2 = y1 + usedHeight;//bottom-left x3 = x2 + (width / 2);//bottom-right y3 = y2;//bottom-right x4 = x3;//top-right y4 = y3 - usedHeight;//top-right u1 = u * texPixPercent + (uw - (width / 2)) * texPixPercent; v1 = v * texPixPercent + (8 * texPixPercent); u2 = u1; v2 = v1 + usedHeight * texPixPercent; u3 = u2 + (width / 2) * texPixPercent; v3 = v2; u4 = u3; v4 = v3 - usedHeight * texPixPercent; renderQuad(x1, y1, x2, y2, x3, y3, x4, y4, u1, v1, u2, v2, u3, v3, u4, v4); nextY += usedHeight; } } GL11.glEndList(); }
From source file:shadowmage.ancient_framework.client.model.Primitive.java
License:Open Source License
public void buildDisplayList() { if (this.displayListNumber < 0) { this.displayListNumber = GL11.glGenLists(1); }//from ww w . j a v a2 s . c o m GL11.glNewList(displayListNumber, GL11.GL_COMPILE); if (x != 0 || y != 0 || z != 0) { GL11.glTranslatef(x, y, z); } if (rx != 0) { GL11.glRotatef(rx, 1, 0, 0); } if (ry != 0) { GL11.glRotatef(ry, 0, 1, 0); } if (rz != 0) { GL11.glRotatef(rz, 0, 0, 1); } renderForDisplayList(); if (x != 0 || y != 0 || z != 0) { GL11.glTranslatef(-x, -y, -z); } if (rx != 0) { GL11.glRotatef(-rx, 1, 0, 0); } if (ry != 0) { GL11.glRotatef(-ry, 0, 1, 0); } if (rz != 0) { GL11.glRotatef(-rz, 0, 0, 1); } GL11.glEndList(); setCompiled(true); }
From source file:shadowmage.meim.client.gui.GuiModelEditor.java
License:Open Source License
private void renderGrid() { GL11.glDisable(GL11.GL_TEXTURE_2D);/* w w w. j a va 2s. c o m*/ GL11.glDisable(GL11.GL_LIGHTING); GL11.glLineWidth(2.f); if (gridDisplayList >= 0) { GL11.glCallList(gridDisplayList); } else { gridDisplayList = GL11.glGenLists(1); GL11.glNewList(gridDisplayList, GL11.GL_COMPILE_AND_EXECUTE); GL11.glColor4f(0.f, 0.f, 1.f, 1.f); for (int x = -5; x <= 5; x++) { GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3f(x, 0.f, -5.f); GL11.glVertex3f(x, 0.f, 5.f); GL11.glEnd(); } for (int z = -5; z <= 5; z++) { GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3f(-5.f, 0.f, z); GL11.glVertex3f(5.f, 0.f, z); GL11.glEnd(); } GL11.glColor4f(1.f, 1.f, 1.f, 1.f); GL11.glEndList(); } GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:taiga.mcmods.buildguide.BlockMarker.java
private void createDisplayList() { //if neded create the list if (displaylist == -1) displaylist = GL11.glGenLists(1); GL11.glNewList(displaylist, GL11.GL_COMPILE_AND_EXECUTE); GL11.glDisable(GL11.GL_FOG);/* w ww .j av a 2 s . c o m*/ GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_POINT_SMOOTH); GL11.glBegin(GL11.GL_POINTS); if (color != null) GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); for (Point3D pt : points) GL11.glVertex3d(pt.getX(), pt.getY(), pt.getZ()); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEndList(); regendisplist = false; }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static int glGenLists(int a) { return GL11.glGenLists(a); }
From source file:yk.myengine.optiseq.states.LWJGLFont.java
/** * <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 . java 2 s .c o m */ public void buildDisplayList() { final int displacement = 10; final int symbolWidth = 16; final int symbolHeight = 16; final int symbolNumX = 16; final int symbolNumY = 16; final int symbolNumber = 256; float cx; float cy; final float texSymSizeX = (float) 1 / symbolNumX; final float texSymSizeY = (float) 1 / symbolNumY; base = GL11.glGenLists(symbolNumber); final float addDisY = texSymSizeY / 100; for (int loop = 0; loop < symbolNumber; loop++) { cx = (loop % symbolNumX) * texSymSizeX; cy = (loop / symbolNumY) * texSymSizeX; GL11.glNewList(base + loop, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(cx, 1 - cy - addDisY); GL11.glVertex2i(0, symbolHeight); GL11.glTexCoord2f(cx, 1 - cy - texSymSizeY + addDisY); GL11.glVertex2i(0, 0); GL11.glTexCoord2f(cx + texSymSizeX, 1 - cy - texSymSizeY + addDisY); GL11.glVertex2i(symbolWidth, 0); GL11.glTexCoord2f(cx + texSymSizeX, 1 - cy - addDisY); GL11.glVertex2i(symbolWidth, symbolHeight); GL11.glEnd(); GL11.glTranslatef(displacement, 0, 0); GL11.glEndList(); } }