List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:hud.OrdersDisplay.java
License:Open Source License
public void draw() { GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE); GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f); GL11.glLineWidth(2.0f);/* ww w . ja v a2 s .c o m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.8f); GL11.glEnable(GL11.GL_BLEND); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glPushMatrix(); GL11.glTranslatef(x + 16, y + 16, 0); ais[curAI].draw(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); Material.DEFAULT_WHITE.bind(); }
From source file:hud.StatusBar.java
License:Open Source License
public void draw() { GL11.glColor4f(0.0f, 0.5f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS);//from ww w . j av a2s .c o m // Draw energy GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + 8); GL11.glVertex2i(x + value, y + 8); GL11.glVertex2i(x + value, y); GL11.glEnd(); }
From source file:hud.StatusOverlay.java
License:Open Source License
public void draw() { int energy = Math.round(player.getMech().getEnergy() * 2.56f); int armour = Math.round(player.getMech().getArmour() * 2.56f); int baseArmour = player.getHomeBase().getLife(); int ammo = Math.round(player.getMech().getAmmo() * 2.56f); baseStatus.setValue(baseArmour);/* w ww. j a v a 2 s . co m*/ if (player.getUnitOrder() != null) { if (player.getUnitOrder().ready()) { orderReadyIcon.bind(); } else { orderProcessingIcon.bind(); } GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(384, 16); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(384, 48); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(384 + 32, 48); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(384 + 32, 16); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); } GL11.glDisable(GL11.GL_LIGHTING); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glDisable(GL11.GL_TEXTURE_2D); GL13.glActiveTexture(GL13.GL_TEXTURE1); GL11.glDisable(GL11.GL_TEXTURE_2D); energyStatus.draw(); armourStatus.draw(); baseStatus.draw(); ammoStatus.draw(); }
From source file:hud.UnitDisplay.java
License:Open Source License
public void draw() { GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE); GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f); GL11.glLineWidth(2.0f);/*from w w w . j ava2 s . c om*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.8f); GL11.glEnable(GL11.GL_BLEND); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); int[] viewport = GLUtils.getViewport(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluPerspective(45, 1.0f, 0.001f, 5.0f); GL11.glViewport(getX(), viewport[3] - (getY() + height), width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluLookAt(2.0f * (float) Math.cos(angle), 2.0f * (float) Math.sin(angle), 1.0f, 0, 0, 0, 0, 0, 1); // GL11.glTranslatef(x + width/2, y + height/2,0); currentUnit.draw(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); }
From source file:illarion.graphics.lwjgl.render.TextureRenderImmediate.java
License:Open Source License
/** * Draw a texture at a specified location using the immediate mode. * /*from www .j av a2 s . c o m*/ * @param x the x coordinate of the texture * @param y the y coordinate of the texture * @param z the z coordinate (so the layer) of the texture * @param width the width of the area the texture shall be rendered on * @param height the height of the area the texture shall be rendered on * @param texture the texture that shall be drawn * @param color the color that is supposed to be used with that texture * @param mirror mirror the texture horizontal * @param rotation the value the texture is rotated by */ @Override public void drawTexture(final float x, final float y, final float z, final float width, final float height, final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) { DriverSettingsLWJGL.getInstance().enableTexture(texture.getTextureID()); color.setActiveColor(); GL11.glPushMatrix(); int xmod = 1; if (mirror) { xmod = -1; GL11.glTranslatef(x + width, y, z); } else { GL11.glTranslatef(x, y, z); } GL11.glScalef(width * xmod, height, 1.f); GL11.glTranslatef(0.5f, 0.5f, 0); if (rotation != 0.f) { GL11.glRotatef(rotation, 0, 0, 1); } GL11.glBegin(GL11.GL_TRIANGLE_STRIP); if (mirror) { GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY2()); GL11.glVertex2f(-0.5f, -0.5f); GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY1()); GL11.glVertex2f(-0.5f, 0.5f); GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY2()); GL11.glVertex2f(0.5f, -0.5f); GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY1()); GL11.glVertex2f(0.5f, 0.5f); } else { GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY2()); GL11.glVertex2f(-0.5f, -0.5f); GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY1()); GL11.glVertex2f(-0.5f, 0.5f); GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY2()); GL11.glVertex2f(0.5f, -0.5f); GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY1()); GL11.glVertex2f(0.5f, 0.5f); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:illarion.graphics.lwjgl.TextureLWJGL.java
License:Open Source License
/** * Generate the display list in case its needed and return the ID of the * list needed to display this texture./*from w w w . ja va 2s .c o m*/ * * @return the ID of the display list */ public int getDisplayListID() { if ((displayListID == -1) || displayListDirty) { if (displayListID == -1) { displayListID = GL11.glGenLists(1); } GL11.glNewList(displayListID, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glTexCoord2f(getRelX1(), getRelY2()); GL11.glVertex2f(-0.5f, -0.5f); GL11.glTexCoord2f(getRelX1(), getRelY1()); GL11.glVertex2f(-0.5f, 0.5f); GL11.glTexCoord2f(getRelX2(), getRelY2()); GL11.glVertex2f(0.5f, -0.5f); GL11.glTexCoord2f(getRelX2(), getRelY1()); GL11.glVertex2f(0.5f, 0.5f); GL11.glEnd(); GL11.glEndList(); displayListDirty = false; } return displayListID; }
From source file:im.bci.jnuit.lwjgl.LwjglNuitFont.java
License:Open Source License
private void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX, float scaleY, Align format) { IntObject intObject = null;//from w w w . j a v a 2 s . c om int charCurrent; int totalwidth = 0; int i = startIndex, d, c; float startY = 0; switch (format) { case RIGHT: { d = -1; c = correctR; while (i < endIndex) { if (whatchars.charAt(i) == '\n') { startY -= fontHeight; } i++; } break; } case CENTER: { for (int l = startIndex; l <= endIndex; l++) { charCurrent = whatchars.charAt(l); if (charCurrent == '\n') { break; } if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { intObject = customChars.get(new Character((char) charCurrent)); } totalwidth += intObject.width - correctL; } totalwidth /= -2; } case LEFT: default: d = 1; c = correctL; break; } GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glBegin(GL11.GL_QUADS); while (i >= startIndex && i <= endIndex) { charCurrent = whatchars.charAt(i); if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { intObject = customChars.get(new Character((char) charCurrent)); } if (intObject != null) { if (d < 0) { totalwidth += (intObject.width - c) * d; } if (charCurrent == '\n') { startY -= fontHeight * d; totalwidth = 0; if (format == Align.CENTER) { for (int l = i + 1; l <= endIndex; l++) { charCurrent = whatchars.charAt(l); if (charCurrent == '\n') { break; } if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { intObject = customChars.get(new Character((char) charCurrent)); } totalwidth += intObject.width - correctL; } totalwidth /= -2; } // if center get next lines total width/2; } else { drawQuad((totalwidth + intObject.width) * scaleX + x, startY * scaleY + y, totalwidth * scaleX + x, (startY + intObject.height) * scaleY + y, intObject.storedX + intObject.width, intObject.storedY + intObject.height, intObject.storedX, intObject.storedY); if (d > 0) { totalwidth += (intObject.width - c) * d; } } i += d; } } GL11.glEnd(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(Widget widget, TexturedBackground background) { IAnimationFrame frame = background.getPlay().getCurrentFrame(); if (null != frame) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, (Integer) frame.getImage().getId()); float x1 = widget.getX(); float x2 = widget.getX() + widget.getWidth(); float y1 = widget.getY(); float y2 = widget.getY() + widget.getHeight(); float u1 = background.isMirrorX() ? frame.getU2() : frame.getU1(); float v1 = background.isMirrorY() ? frame.getV2() : frame.getV1(); float u2 = background.isMirrorX() ? frame.getU1() : frame.getU2(); float v2 = background.isMirrorY() ? frame.getV1() : frame.getV2(); GL11.glBegin(GL11.GL_QUADS);//w w w .j a v a2 s.c o m GL11.glTexCoord2f(u1, v2); GL11.glVertex2f(x1, y2); GL11.glTexCoord2f(u2, v2); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2, v1); GL11.glVertex2f(x2, y1); GL11.glTexCoord2f(u1, v1); GL11.glVertex2f(x1, y1); GL11.glEnd(); } }
From source file:info.plugmania.novacraft.event.gui.Render3DOverlayEvent.java
License:GNU General Public License
public void drawLine(Position point1, Position point2, int colour, float lineWidth) { float red = (float) (colour >> 24 & 255) / 255.0F; float green = (float) (colour >> 16 & 255) / 255.0F; float blue = (float) (colour >> 8 & 255) / 255.0F; float alpha = (float) (colour & 255) / 255.0F; GL11.glColor4f(red, green, blue, alpha); GL11.glLineWidth(lineWidth);//from w w w . java 2 s . co m enable(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(point1.getX() - p.posX, point1.getY() - p.posY, point1.getZ() - p.posZ); GL11.glVertex3d(point2.getX() - p.posX, point2.getY() - p.posY, point2.getZ() - p.posZ); GL11.glEnd(); disable(); }
From source file:io.flob.blackheart.CollectableGold.java
License:Open Source License
@Override public void _render() { GL11.glEnd(); GL11.glPushMatrix();/* w w w.j a v a2 s . c om*/ GL11.glTranslatef(position().getX(), position().getY(), position().getZ()); FloatBuffer modelview = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview); for (int i = 0; i < 3; i += 2) { for (int j = 0; j < 3; j++) { if (i == j) { modelview.put(i * 4 + j, 1.0f); } else { modelview.put(i * 4 + j, 0.0f); } } } GL11.glLoadMatrix(modelview); GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0f, 0f, 1f); GL11.glTexCoord2f(_texture[state].getU(), _texture[state].getV2()); GL11.glVertex2f(-size(), -size()); GL11.glTexCoord2f(_texture[state].getU2(), _texture[state].getV2()); GL11.glVertex2f(size(), -size()); GL11.glTexCoord2f(_texture[state].getU2(), _texture[state].getV()); GL11.glVertex2f(size(), size()); GL11.glTexCoord2f(_texture[state].getU(), _texture[state].getV()); GL11.glVertex2f(-size(), size()); GL11.glEnd(); GL11.glPopMatrix(); GL11.glBegin(GL11.GL_QUADS); }