List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:br.org.archimedes.gui.opengl.OpenGLWrapper.java
License:Open Source License
/** * Draws the collection of points based on the current geometric primitive. * /*from w w w .j av a 2s.c o m*/ * @param points * Points in the model coordinate system */ public void drawFromModel(Point... points) { GL11.glBegin(primitiveType); for (Point point : points) { try { Point convertedPoint = br.org.archimedes.Utils.getWorkspace().modelToScreen(point); GL11.glVertex2d(convertedPoint.getX(), convertedPoint.getY()); } catch (NullArgumentException e) { // Ignores if the list contains a null point e.printStackTrace(); } } GL11.glEnd(); }
From source file:br.org.archimedes.gui.opengl.OpenGLWrapper.java
License:Open Source License
/** * Draws the collection of points based on the current geometric primitive. * //from w w w .j a va2s . c om * @param points * Points in the screen coordinate system * @throws NullArgumentException * Thrown if points is null */ public void draw(List<Point> points) throws NullArgumentException { if (points == null) { throw new NullArgumentException(); } GL11.glBegin(primitiveType); for (Point point : points) { GL11.glVertex2d(point.getX(), point.getY()); } GL11.glEnd(); }
From source file:br.org.archimedes.gui.opengl.OpenGLWrapper.java
License:Open Source License
/** * @param points//from w ww . jav a 2 s . com * The list of points to be drawed. */ public void draw(Point... points) { GL11.glBegin(primitiveType); for (Point point : points) { GL11.glVertex2d(point.getX(), point.getY()); } GL11.glEnd(); }
From source file:cellSim2.GradientWall.java
License:Open Source License
public boolean specialRender(IGL gl, Transform t) { if (grad == null) { return false; }//from w ww. j ava 2s .c o m //get the time long ti = sim.getCurrentTimeMicroseconds(); int axis = grad.getAxis(); float[] wallSize = new float[3]; getSize().get(wallSize); float blockSize = wallSize[axis] / (float) drawnSegments; float[] diagonal = new float[3]; switch (axis) { case 0: diagonal[0] = -blockSize; diagonal[1] = -wallSize[1];//height diagonal[2] = 0; break; case 1: diagonal[0] = wallSize[0];//width diagonal[1] = blockSize; diagonal[2] = 0; break; case 2: diagonal[0] = 0; diagonal[1] = wallSize[1]; diagonal[2] = blockSize; break; } Vector3f diagonalVector = new Vector3f(diagonal); //System.out.println(diagonalVector); float[] nextPos = new float[] { 0f, 0f, 0f }; nextPos[axis] = blockSize; Vector3f nextPositionVector = new Vector3f(nextPos); //System.out.println(nextPositionVector); float[] dist = new float[] { 0f, 0f, 0f }; dist[axis] = distanceFromSource; Vector3f distVector = new Vector3f(dist); gl.glPushMatrix(); t.getOpenGLMatrix(glMat); gl.glMultMatrix(glMat); GL11.glNormal3f(0f, 0f, -1f); Vector3f vecOne = new Vector3f(startPoint); Vector3f vecTwo = new Vector3f(vecOne); vecTwo.add(diagonalVector); for (int i = 0; i < drawnSegments; i++) { //Find the concentration at this time and position //System.out.println("VecOne: " + vecOne + " VecTwo: " + vecTwo); Vector3f gradPos = new Vector3f(); gradPos.add(vecOne, distVector); float[] color = grad.getColor(grad.getConcentration(ti, gradPos)); GL11.glColor3f(color[0], color[1], color[2]); GL11.glBegin(GL11.GL_QUADS); //System.out.println(i + "ri: " + ri + " le: " + le + " con: " + con + " mi: " + mi); GL11.glVertex3f(vecOne.x, vecOne.y, vecOne.z); GL11.glVertex3f(vecTwo.x, vecOne.y, vecTwo.z); GL11.glVertex3f(vecTwo.x, vecTwo.y, vecTwo.z); GL11.glVertex3f(vecOne.x, vecTwo.y, vecOne.z); GL11.glEnd(); vecOne.add(nextPositionVector); vecTwo.add(vecOne, diagonalVector); //System.out.println(startPoint + ", " + vecOne + ", " +addOnVector +", "+ vecTwo); } gl.glPopMatrix(); return true; //return false; }
From source file:cellularautomata.CellularAutomata.java
public static void drawPath(TrueTypeFont trueTypeTitleFont, TrueTypeFont trueTypeDimensionsFont) { updateColour(7);/* w ww . j a v a 2s .c o m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(712, 0); GL11.glVertex2f(712, 600); GL11.glVertex2f(0, 600); GL11.glEnd(); for (int yi = 0; yi < 7; yi++) { updateColour(7); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(712, yi * 86); GL11.glVertex2f(800, yi * 86); GL11.glVertex2f(800, yi * 86 + 85); GL11.glVertex2f(712, yi * 86 + 85); GL11.glEnd(); } for (int yi = 0; yi < 7; yi++) { for (int xi = 0; xi < 10; xi++) { if (yi == 0) { updateColour(0); } else { updateColour(path[yi - 1][xi]); } GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(xi * 62 + 90, yi * 86); GL11.glVertex2f(xi * 62 + 61 + 90, yi * 86); GL11.glVertex2f(xi * 62 + 61 + 90, yi * 86 + 85); GL11.glVertex2f(xi * 62 + 90, yi * 86 + 85); GL11.glEnd(); } } for (int yi = 0; yi < 7; yi++) { for (int xi = 0; xi < 9; xi = xi + 8) { updateColour(yi); if (xi == 0) { GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, yi * 86); GL11.glVertex2f(89, yi * 86); GL11.glVertex2f(89, yi * 86 + 85); GL11.glVertex2f(0, yi * 86 + 85); GL11.glEnd(); } } } GL11.glEnable(GL11.GL_TEXTURE_2D); //Enables textures. for (int i = 0; i < 9; i++) { trueTypeTitleFont.drawString(110 + 62 * i, 20, i + 1 + "", Color.black); } trueTypeTitleFont.drawString(668, 20, "0", Color.black); String dimensions = ""; boolean dimensionsSelected = false; for (int yi = 0; yi < 7; yi++) { if (yi == 0) { dimensions = "800 x 600"; if (pixel == 1) { dimensionsSelected = true; borderSize = 0; } else { dimensionsSelected = false; } } if (yi == 1) { dimensions = "400 x 300"; if (pixel == 2) { dimensionsSelected = true; borderSize = 0; } else { dimensionsSelected = false; } } if (yi == 2) { dimensions = "200 x 150"; if (pixel == 4) { dimensionsSelected = true; borderSize = 0; } else { dimensionsSelected = false; } } if (yi == 3) { dimensions = " 80 x 60"; if (pixel == 10) { dimensionsSelected = true; } else { dimensionsSelected = false; } } if (yi == 4) { dimensions = " 32 x 24"; if (pixel == 25) { dimensionsSelected = true; } else { dimensionsSelected = false; } } if (yi == 5) { dimensions = " 16 x 12"; if (pixel == 50) { dimensionsSelected = true; } else { dimensionsSelected = false; } } if (yi == 6) { dimensions = " 8 x 6"; if (pixel == 100) { dimensionsSelected = true; } else { dimensionsSelected = false; } } if (dimensionsSelected) { trueTypeDimensionsFont.drawString(713, 28 + 86 * yi, dimensions, Color.yellow); } else { trueTypeDimensionsFont.drawString(713, 28 + 86 * yi, dimensions, Color.white); } } GL11.glDisable(GL11.GL_TEXTURE_2D); }
From source file:cellularautomata.CellularAutomata.java
public static void drawWeight(int background, int squares, TrueTypeFont trueTypeTitleFont, TrueTypeFont trueTypePaintBrushFont) { updateColour(background);/*w ww . j a va 2s .co m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(711, 0); GL11.glVertex2f(711, 600); GL11.glVertex2f(0, 600); GL11.glEnd(); Color.black.bind(); for (int yi = 0; yi < 7; yi++) { for (int xi = 0; xi < 9; xi++) { updateColour(squares); if (xi == 0) { updateColour(yi); } if (xi == 8) { updateColour(0); } GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(xi * 89, yi * 86); GL11.glVertex2f(xi * 89 + 88, yi * 86); GL11.glVertex2f(xi * 89 + 88, yi * 86 + 85); GL11.glVertex2f(xi * 89, yi * 86 + 85); GL11.glEnd(); } } GL11.glEnable(GL11.GL_TEXTURE_2D); //Enables textures. for (int yi = 0; yi < 7; yi++) { for (int xi = 0; xi < 7; xi++) { if (xi != 3 || yi != 3) { if (squares == 1 || squares == 6) { trueTypeTitleFont.drawString(120 + 89 * xi, 20 + 86 * yi, neighbourhood[yi][xi][menuState] + "", Color.white); } else { trueTypeTitleFont.drawString(120 + 89 * xi, 20 + 86 * yi, neighbourhood[yi][xi][menuState] + "", Color.black); } } } } String stateString = ""; for (int yi = 1; yi < 7; yi++) { if (yi == 1) { if (black == 1) { stateString = " Left"; } else if (black == 2) stateString = "Right"; else { stateString = " Off"; } trueTypePaintBrushFont.drawString(720, 25 + 86 * yi, stateString, Color.black); } if (yi == 2) { if (white == 1) { stateString = " Left"; } else if (white == 2) stateString = "Right"; else { stateString = " Off"; } trueTypePaintBrushFont.drawString(720, 25 + 86 * yi, stateString, Color.white); } if (yi == 3) { if (red == 1) { stateString = " Left"; } else if (red == 2) stateString = "Right"; else { stateString = " Off"; } trueTypePaintBrushFont.drawString(720, 25 + 86 * yi, stateString, Color.red); } if (yi == 4) { if (blue == 1) { stateString = " Left"; } else if (blue == 2) stateString = "Right"; else { stateString = " Off"; } trueTypePaintBrushFont.drawString(720, 25 + 86 * yi, stateString, Color.blue); } if (yi == 5) { if (green == 1) { stateString = " Left"; } else if (green == 2) stateString = "Right"; else { stateString = " Off"; } trueTypePaintBrushFont.drawString(720, 25 + 86 * yi, stateString, Color.green.darker(.7f)); } if (yi == 6) { if (purple == 1) { stateString = " Left"; } else if (purple == 2) stateString = "Right"; else { stateString = " Off"; } trueTypePaintBrushFont.drawString(720, 20 + 86 * yi, stateString, Color.magenta.darker(.7f)); } } if (screenState == 1 && menuState != 6) { trueTypeTitleFont.drawString(745, 20, brushRadius + "", Color.black); } GL11.glDisable(GL11.GL_TEXTURE_2D); }
From source file:cellularautomata.CellularAutomata.java
public static void drawBoard() { updateColour(0);/*from w w w .j a v a 2s .co m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, 0); GL11.glVertex2f(800, 0); GL11.glVertex2f(800, 600); GL11.glVertex2f(0, 600); GL11.glEnd(); for (int yi = 0; yi < 600 / pixel; yi++) { for (int xi = 0; xi < 800 / pixel; xi++) { updateColour(state[xi][yi][currentRound]); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(xi * pixel + borderSize, yi * pixel + borderSize); GL11.glVertex2f(xi * pixel + pixel - borderSize, yi * pixel + borderSize); GL11.glVertex2f(xi * pixel + pixel - borderSize, yi * pixel + pixel - borderSize); GL11.glVertex2f(xi * pixel + borderSize, yi * pixel + pixel - borderSize); GL11.glEnd(); } } }
From source file:cn.academy.crafting.client.render.item.RendererMatterUnit.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { ItemMatterUnit item = ModuleCrafting.matterUnit; GL11.glColor4d(1, 1, 1, 1);//from w w w . j ava2 s.c o m if (type != ItemRenderType.INVENTORY) { GL11.glPushMatrix(); { if (type == ItemRenderType.ENTITY) GL11.glTranslated(-.5, -0.1, 0); RenderUtils.drawEquippedItem(stack, 0.0625f); GL11.glColorMask(false, false, false, false); RenderUtils.drawEquippedItem(0.0626f, texMask, texMask); GL11.glColorMask(true, true, true, true); GL11.glDepthFunc(GL11.GL_EQUAL); MatterMaterial mat = item.getMaterial(stack); RenderUtils.drawEquippedItemOverlay(0.0626f, mat.texture); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glPopMatrix(); } else { ShaderMask shader = ShaderMask.instance; float du = -(GameTimer.getAbsTime() % 10000L) / 1e4f, dv = (GameTimer.getAbsTime() % 10000L) / 1e4f; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.renderItemInventory(stack); shader.start(texMask); RenderUtils.loadTexture(item.getMaterial(stack).texture); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0 + du, 0 + dv); shader.maskTexCoord(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0 + du, 1 + dv); shader.maskTexCoord(0, 1); GL11.glVertex2f(0, 16); GL11.glTexCoord2f(1 + du, 1 + dv); shader.maskTexCoord(1, 1); GL11.glVertex2f(16, 16); GL11.glTexCoord2f(1 + du, 0 + dv); shader.maskTexCoord(1, 0); GL11.glVertex2f(16, 0); GL11.glEnd(); shader.end(); GL11.glDisable(GL11.GL_BLEND); } }
From source file:colonialdisplay.AntDisplayGL.java
private void drawTile(Rectangle bounds, Rectangle2D.Float r) { GL11.glBegin(GL11.GL_QUADS);//from w w w . j a va2s. c o m GL11.glTexCoord2f(r.x, r.y + r.height); GL11.glVertex2f(bounds.x, bounds.y + bounds.height); GL11.glTexCoord2f(r.x + r.width, r.y + r.height); GL11.glVertex2f(bounds.x + bounds.width, bounds.y + bounds.height); GL11.glTexCoord2f(r.x + r.width, r.y); GL11.glVertex2f(bounds.x + bounds.width, bounds.y); GL11.glTexCoord2f(r.x, r.y); GL11.glVertex2f(bounds.x, bounds.y); GL11.glEnd(); }
From source file:com.a2client.corex.Skeleton.java
License:Open Source License
public void draw_bones() { for (int i = 0; i < joint.length; i++) { updateJoint(i);/* www . ja v a2s. c o m*/ if (data.base[i].parent != -1 && joint[i] != null) { Vec3f p1 = joint[i].pos(); Vec3f p2 = joint[data.base[i].parent].pos(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(p1.x, p1.y, p1.z); GL11.glVertex3f(p2.x, p2.y, p2.z); GL11.glEnd(); } } }