List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:org.meanworks.engine.gui.impl.PerformanceGraph.java
License:Open Source License
public void render() { GL11.glDisable(GL11.GL_TEXTURE_2D);/*w ww. j a va 2s. c om*/ GL11.glBegin(GL11.GL_LINES); { for (PerformanceGraphEntry pge : graphs.values()) { pge.render(); } } GL11.glEnd(); }
From source file:org.meanworks.engine.gui.Surface.java
License:Open Source License
/** * Draw a line//from w w w.ja va2 s. c o m * * @param x1 * @param y1 * @param x2 * @param y2 */ public void drawLine(int x1, int y1, int x2, int y2) { GL11.glBegin(GL11.GL_LINES); { glVertex2f(x1, y1); glVertex2f(x2, y2); } GL11.glEnd(); }
From source file:org.minetweak.world.World.java
License:Apache License
private void renderOverlay() { Configuration conf = Game.getInstance().getConfiguration(); Game.getInstance().initOverlayRendering(); GL11.glColor3f(1, 1, 1);/* ww w .java 2s. com*/ if (Game.RENDER_INFORMATION_OVERLAY) { GLFont infoFont = FontStorage.getFont("Monospaced_20"); /* Down Left Info */ infoFont.print(4, 4, "CraftMania"); infoFont.print(4, 30, _player.coordinatesToString()); infoFont.print(4, 45, "Visible Chunks: " + _visibleChunks.size()); infoFont.print(4, 60, "Updading Blocks: " + _updatingBlocks); infoFont.print(4, 75, "Total Chunks in RAM: " + _chunkManager.getTotalChunkCount()); infoFont.print(4, 90, "Local Chunks: " + _localChunks.size()); infoFont.print(4, 105, "Total Local Blocks: " + _localBlockCount); infoFont.print(4, 120, "Time: " + _time); infoFont.print(4, 135, "Sunlight: " + _sunlight); } /** RENDER **/ if (currentGui != null) { Game.getInstance().renderTransculentOverlayLayer(); currentGui.render(); } else { int width = conf.getWidth(); int height = conf.getHeight(); // Center Cross GL11.glDisable(GL11.GL_TEXTURE_2D); if (CENTER_CROSS_CALL_LIST == 0) { CENTER_CROSS_CALL_LIST = GL11.glGenLists(1); GL11.glNewList(CENTER_CROSS_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE); int crossSize = 10; int crossHole = 5; GL11.glLineWidth(2.5f); GL11.glColor3f(0, 0, 0); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(width / 2f - crossSize - crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f - crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f + crossSize + crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f + crossHole, height / 2f, 0); GL11.glVertex3f(width / 2f, height / 2f - crossSize - crossHole, 0); GL11.glVertex3f(width / 2f, height / 2f - crossHole, 0); GL11.glVertex3f(width / 2f, height / 2f + crossSize + crossHole, 0); GL11.glVertex3f(width / 2f, height / 2f + crossHole, 0); GL11.glEnd(); GL11.glEndList(); } else { GL11.glCallList(CENTER_CROSS_CALL_LIST); } GL11.glEnable(GL11.GL_TEXTURE_2D); // Inventory bar GL11.glPushMatrix(); Texture texGui = TextureStorage.getTexture("gui.gui"); texGui.bind(); float tileSize = 20.0f / texGui.getImageWidth(); if (INVENTORY_BAR_CALL_LIST == 0) { INVENTORY_BAR_CALL_LIST = GL11.glGenLists(2); /* Bar */ GL11.glNewList(INVENTORY_BAR_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE); GL11.glTranslatef(width / 2.0f - 9 * 20, 10, 0); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 40); GL11.glTexCoord2f(tileSize * 9, 0); GL11.glVertex2f(9 * 40, 40); GL11.glTexCoord2f(tileSize * 9, tileSize); GL11.glVertex2f(9 * 40, 0); GL11.glTexCoord2f(0, tileSize); GL11.glVertex2f(0, 0); GL11.glEnd(); GL11.glEndList(); /* Little frame around selected item */ float frameTileSize = 24.0f / texGui.getImageWidth(); float frameTileY = 22.0f / texGui.getImageHeight(); GL11.glNewList(INVENTORY_BAR_CALL_LIST + 1, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, frameTileY); GL11.glVertex2f(0, 48); GL11.glTexCoord2f(frameTileSize, frameTileY); GL11.glVertex2f(48, 48); GL11.glTexCoord2f(frameTileSize, frameTileY + frameTileSize); GL11.glVertex2f(48, 0); GL11.glTexCoord2f(0, frameTileY + frameTileSize); GL11.glVertex2f(0, 0); GL11.glEnd(); GL11.glEndList(); } else { GL11.glCallList(INVENTORY_BAR_CALL_LIST); } /* Content */ GL11.glPushMatrix(); GL11.glTranslatef(20, 20, 0); for (int i = 0; i < 9; ++i) { Inventory.InventoryPlace place = getActivePlayer().getInventory().getInventoryPlace(i); if (place != null) { place.render(); } GL11.glTranslatef(40, 0, 0); } texGui.bind(); GL11.glPopMatrix(); GL11.glTranslatef(getActivePlayer().getSelectedInventoryItemIndex() * 40.0f - 4, -4, 0); GL11.glCallList(INVENTORY_BAR_CALL_LIST + 1); GL11.glPopMatrix(); } }
From source file:org.mkdev.ai.langton3d.core.App.java
License:GNU General Public License
private void drawBackground() { GL11.glDisable(GL11.GL_DEPTH_TEST);//w ww . jav a 2s. c o m GL11.glDisable(GL11.GL_LIGHTING); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glClearColor(Settings.BKG_COLOR_RED, Settings.BKG_COLOR_GREEN, Settings.BKG_COLOR_BLUE, Settings.BKG_COLOR_ALPHA); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glDisable(GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(Settings.BKG_COLOR_RED, Settings.BKG_COLOR_GREEN, Settings.BKG_COLOR_BLUE, Settings.BKG_COLOR_ALPHA); GL11.glVertex2f(-1.0f, -1.0f); GL11.glVertex2f(1.0f, -1.0f); GL11.glColor4f(Settings.BKG_COLOR_RED / 2, Settings.BKG_COLOR_GREEN / 2, Settings.BKG_COLOR_BLUE / 2, Settings.BKG_COLOR_ALPHA); GL11.glVertex2f(1.0f, 1.0f); GL11.glVertex2f(-1.0f, 1.0f); GL11.glEnd(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:org.mkdev.ai.langton3d.core.App.java
License:GNU General Public License
private void drawSceneCubes() { GL11.glTranslatef(-(MapCube.getCubeSize() / 2), -(MapCube.getCubeSize() / 2), -(MapCube.getCubeSize() / 2)); GL11.glBegin(GL11.GL_QUADS); int[] planeStep = new int[] { MapCube.D / 2, MapCube.D / 2, MapCube.D / 2 }; float x1;/*from w w w.j a v a2 s . c o m*/ float x2; float x3; x1 = 0f; int xlim = Math.min(MapCube.W, planeStep[0] + MapCube.D / 2); for (int x = 0; x < xlim; x++) { x1 += MapCube.getCubeSize(); x2 = 0f; for (int y = 0; y < MapCube.H; y++) { x2 += MapCube.getCubeSize(); x3 = 0; for (int localz = 0; localz < MapCube.D; localz++) { x3 += MapCube.getCubeSize(); int cl = mapCube.getElement(x, y, localz); int n = mapCube.getNeighbours(x, y, localz); if (n != 63) { if (cl != 0) { incrementDrawCubeCount(); GL11.glColor3f((float) colors[cl][0], (float) colors[cl][1], (float) colors[cl][2]); if (x == xlim - 1) { GLUT.drawWholeCube(MapCube.getCubeSize() / 2, x1, x2, x3, x, y, localz); } else { GLUT.drawCube(x1, x2, x3, MapCube.getCubeSize() / 2, mapCube.getNeighbours(x, y, localz)); } } } } } } GL11.glEnd(); GL11.glTranslatef(MapCube.getCubeSize() / 2, MapCube.getCubeSize() / 2, MapCube.getCubeSize() / 2); }
From source file:org.mkdev.ai.langton3d.misc.GLUT.java
License:GNU General Public License
public static void drawBox(double size, int type) { float v[][] = new float[8][3]; float sz = (float) size; int i;/*from w ww . j a v a2 s.com*/ v[0][0] = v[1][0] = v[2][0] = v[3][0] = -sz / 2.0f; v[4][0] = v[5][0] = v[6][0] = v[7][0] = sz / 2.0f; v[0][1] = v[1][1] = v[4][1] = v[5][1] = -sz / 2.0f; v[2][1] = v[3][1] = v[6][1] = v[7][1] = sz / 2.0f; v[0][2] = v[3][2] = v[4][2] = v[7][2] = -sz / 2.0f; v[1][2] = v[2][2] = v[5][2] = v[6][2] = sz / 2.0f; for (i = 5; i >= 0; i--) { GL11.glBegin(type); GL11.glNormal3f(CUBE_NORMALS[i][0], CUBE_NORMALS[i][1], CUBE_NORMALS[i][2]); GL11.glVertex3f(v[CUBE_FACES[i][0]][0], v[CUBE_FACES[i][0]][1], v[CUBE_FACES[i][0]][2]); GL11.glVertex3f(v[CUBE_FACES[i][1]][0], v[CUBE_FACES[i][1]][1], v[CUBE_FACES[i][1]][2]); GL11.glVertex3f(v[CUBE_FACES[i][2]][0], v[CUBE_FACES[i][2]][1], v[CUBE_FACES[i][2]][2]); GL11.glVertex3f(v[CUBE_FACES[i][3]][0], v[CUBE_FACES[i][3]][1], v[CUBE_FACES[i][3]][2]); GL11.glEnd(); } }
From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java
License:Open Source License
private void drawConvex(float[] _planes, int _planecount, float[] _points, int _pointcount, int[] _polygons) { //unsigned //from ww w .j a v a 2s . c o m int polyindex = 0; for (int i = 0; i < _planecount; ++i) { //unsigned int pointcount = _polygons[polyindex]; polyindex++; GL11.glBegin(GL11.GL_POLYGON); GL11.glNormal3f(_planes[(i * 4) + 0], _planes[(i * 4) + 1], _planes[(i * 4) + 2]); for (int j = 0; j < pointcount; ++j) { GL11.glVertex3f(_points[_polygons[polyindex] * 3], _points[(_polygons[polyindex] * 3) + 1], _points[(_polygons[polyindex] * 3) + 2]); polyindex++; } GL11.glEnd(); } }
From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java
License:Open Source License
private void drawConvexD(double[] _planes, int _planecount, double[] _points, int _pointcount, int[] _polygons) { //unsigned // w ww . j av a 2 s. c o m int polyindex = 0; for (int i = 0; i < _planecount; ++i) { //unsigned int pointcount = _polygons[polyindex]; polyindex++; GL11.glBegin(GL11.GL_POLYGON); GL11.glNormal3d(_planes[(i * 4) + 0], _planes[(i * 4) + 1], _planes[(i * 4) + 2]); for (int j = 0; j < pointcount; ++j) { GL11.glVertex3d(_points[_polygons[polyindex] * 3], _points[(_polygons[polyindex] * 3) + 1], _points[(_polygons[polyindex] * 3) + 2]); polyindex++; } GL11.glEnd(); } }
From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java
License:Open Source License
private void drawBox(final float[] sides) { float lx = sides[0] * 0.5f; float ly = sides[1] * 0.5f; float lz = sides[2] * 0.5f; // sides//from ww w . jav a 2s. c o m GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glNormal3f(-1, 0, 0); GL11.glVertex3f(-lx, -ly, -lz); GL11.glVertex3f(-lx, -ly, lz); GL11.glVertex3f(-lx, ly, -lz); GL11.glVertex3f(-lx, ly, lz); GL11.glNormal3f(0, 1, 0); GL11.glVertex3f(lx, ly, -lz); GL11.glVertex3f(lx, ly, lz); GL11.glNormal3f(1, 0, 0); GL11.glVertex3f(lx, -ly, -lz); GL11.glVertex3f(lx, -ly, lz); GL11.glNormal3f(0, -1, 0); GL11.glVertex3f(-lx, -ly, -lz); GL11.glVertex3f(-lx, -ly, lz); GL11.glEnd(); // top face GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glNormal3f(0, 0, 1); GL11.glVertex3f(-lx, -ly, lz); GL11.glVertex3f(lx, -ly, lz); GL11.glVertex3f(lx, ly, lz); GL11.glVertex3f(-lx, ly, lz); GL11.glEnd(); // bottom face GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glNormal3f(0, 0, -1); GL11.glVertex3f(-lx, -ly, -lz); GL11.glVertex3f(-lx, ly, -lz); GL11.glVertex3f(lx, ly, -lz); GL11.glVertex3f(lx, -ly, -lz); GL11.glEnd(); }
From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java
License:Open Source License
private void drawSphere() { // icosahedron data for an icosahedron of radius 1.0 // # define ICX 0.525731112119133606f // # define ICZ 0.850650808352039932f if (listnum == 0) { listnum = GL11.glGenLists(1);//from ww w . j a v a 2 s . c o m GL11.glNewList(listnum, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_TRIANGLES); for (int i = 0; i < 20; i++) { // drawPatch (&idata[index[i][2]][0],&idata[index[i][1]][0], // &idata[index[i][0]][0],sphere_quality); drawPatch(idata[index[i][2]], idata[index[i][1]], idata[index[i][0]], sphere_quality); } GL11.glEnd(); GL11.glEndList(); } GL11.glCallList(listnum); }