List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:org.joge.core.draw.Graphics.java
License:Open Source License
public void fillTriangle(float x, float y, float x1, float y1, float x2, float y2) { setColor();// w w w.j a v a 2 s. com disableGl(); GL11.glBegin(GL11.GL_TRIANGLES); GL11.glVertex2f(x, y); GL11.glVertex2f(x1, y1); GL11.glVertex2f(x2, y2); GL11.glEnd(); enableGl(); }
From source file:org.joge.core.draw.Graphics.java
License:Open Source License
public void drawOvall(float x_center, float y_center, float w, float h, int n) { double pheta, angle_increment; float x, y;//from w ww . j ava 2 s. c o m if (n <= 0) { n = 1; } angle_increment = 2 * PI / n; setColor(); disableGl(); GL11.glPushMatrix(); GL11.glTranslatef(x_center, y_center, 0); GL11.glBegin(GL11.GL_LINE_LOOP); for (pheta = 0.0f; pheta < 2 * PI; pheta += angle_increment) { x = w / 2 * (float) Math.cos(pheta); y = h / 2 * (float) Math.sin(pheta); GL11.glVertex2f(x, y); } GL11.glEnd(); GL11.glPopMatrix(); enableGl(); }
From source file:org.joge.core.draw.Graphics.java
License:Open Source License
public void fillOvall(float x_center, float y_center, float w, float h, int n) { double pheta, angle_increment; float x, y;//from w ww . j av a2 s . com if (n <= 0) { n = 1; } angle_increment = 2 * PI / n; setColor(); disableGl(); GL11.glPushMatrix(); GL11.glTranslatef(x_center, y_center, 0); GL11.glBegin(GL11.GL_TRIANGLE_FAN); for (pheta = 0.0f; pheta < 2 * PI; pheta += angle_increment) { x = w / 2 * (float) Math.cos(pheta); y = h / 2 * (float) Math.sin(pheta); GL11.glVertex2f(x, y); } GL11.glEnd(); GL11.glPopMatrix(); enableGl(); }
From source file:org.joge.core.draw.Image.java
License:Open Source License
public void drawWithOutLoadIdentity(float xpos, float ypos) { GL11.glTranslatef(x + xpos, y + ypos, 0); GL11.glBegin(GL11.GL_QUADS);//from w w w . jav a2 s . c om { GL11.glTexCoord2f(tOffsetX, tOffsetY); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(tOffsetX, tHeight + tOffsetY); GL11.glVertex2f(0, height); GL11.glTexCoord2f(tWidth + tOffsetX, tHeight + tOffsetY); GL11.glVertex2f(width, height); GL11.glTexCoord2f(tWidth + tOffsetX, tOffsetY); GL11.glVertex2f(width, 0); } GL11.glEnd(); }
From source file:org.jtrfp.mtmx.draw.ModelDrawer.java
License:Open Source License
public void draw() { IBinData binData = model.getBinData(); IBinVertex[] vertexes = binData.getVertexes(); IBinFace[] faces = binData.getFaces(); GL11.glPushMatrix();// w w w . j a v a2s. c om if (translation != null) { GL11.glTranslatef(translation.getX(), translation.getY(), translation.getZ()); } if (scale != null) { GL11.glScalef(scale.getX(), scale.getY(), scale.getZ()); } if (rotationAxis != null) { GL11.glRotatef(rotationAngle, rotationAxis.getX(), rotationAxis.getY(), rotationAxis.getZ()); } float n = 1.0f / 65536; for (int i = 0; i < faces.length; i++) { IBinFace face = faces[i]; ITextureManager textureManager = engine.getResourceManager().getTextureManager(); ITexture texture = textureManager.get(face.getTextureName()); texture.bind(); IBinVertex normal = face.getNormal(); GL11.glBegin(renderMode); IBinTexCoord[] coords = face.getTexCoords(); for (int j = coords.length - 1; j >= 0; j--) { IBinTexCoord coord = coords[j]; IBinVertex vertex = vertexes[coord.getVertexIndex()]; GL11.glNormal3f(-normal.getX() * n, normal.getY() * n, normal.getZ() * n); GL11.glTexCoord2f(coord.getU(), coord.getV()); GL11.glVertex3f(-vertex.getX() * IDrawer.SCALE, vertex.getY() * IDrawer.SCALE, vertex.getZ() * IDrawer.SCALE); } GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:org.meanworks.engine.gui.impl.PerformanceGraph.java
License:Open Source License
public void render() { GL11.glDisable(GL11.GL_TEXTURE_2D);//from www . j ava 2s . c o m 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// w w w . ja va 2 s .c om * * @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);//from w w w. j a v a 2s. co m 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);/*from www. ja v a 2s . c om*/ 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);/*from ww w . j ava2s .co m*/ int[] planeStep = new int[] { MapCube.D / 2, MapCube.D / 2, MapCube.D / 2 }; float x1; 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); }