List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw2dLineStripList() { int lineCount = buffer.getInt(); for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) { int lineLenght = buffer.getInt(); GL11.glBegin(GL11.GL_LINE_STRIP); // Draw line for (int j = 0; j < lineLenght; j++) { GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), 0.0f); }/*from w ww . j a v a2 s. c om*/ GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw3dQuadList() { int quadCount = buffer.getInt(); GL11.glBegin(GL11.GL_QUADS); for (int quadIndex = 0; quadIndex < quadCount; quadIndex++) { for (int i = 0; i < 4; i++) { GL11.glTexCoord2f(buffer.getFloat(), buffer.getFloat()); GL11.glNormal3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); }//from w w w .java2 s . c o m } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw3dTriangleList() { int triangleCount = buffer.getInt(); GL11.glBegin(GL11.GL_TRIANGLES); for (int triangleIndex = 0; triangleIndex < triangleCount; triangleIndex++) { for (int i = 0; i < 3; i++) { GL11.glTexCoord2f(buffer.getFloat(), buffer.getFloat()); GL11.glNormal3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); }//from www .j a v a 2 s .com } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw3dPolygonList() { int polygonCount = buffer.getInt(); for (int polygonIndex = 0; polygonIndex < polygonCount; polygonIndex++) { GL11.glBegin(GL11.GL_POLYGON); int vertexCount = buffer.getInt(); for (int i = 0; i < vertexCount; i++) { GL11.glTexCoord2f(buffer.getFloat(), buffer.getFloat()); GL11.glNormal3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); }//w ww . j av a 2 s .c om GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void drawRegistrated3dConcavePolygon() { int polygonIndex = buffer.getInt(); Tesselation tesselation = concavePolygonList.get(polygonIndex); List<Integer> vertexTypeList = tesselation.getVertexTypeList(); for (int i = 0; i < vertexTypeList.size(); i++) { List<V3DrawVertex> vertexList = tesselation.getVertexListList().get(i); GL11.glBegin(vertexTypeList.get(i)); for (V3DrawVertex vertex : vertexList) { GL11.glTexCoord2f(vertex.texture.x, vertex.texture.y); GL11.glNormal3f(vertex.normal.x, vertex.normal.y, vertex.normal.z); GL11.glVertex3f(vertex.position.x, vertex.position.y, vertex.position.z); }//from w ww. ja v a 2 s. c o m GL11.glEnd(); } }
From source file:fr.ign.cogit.geoxygene.appli.render.primitive.LinePrimitiveRenderer.java
License:Open Source License
/** * Render simple line.//from w ww. j a v a2 s . c o m * @param primitive primitive to paint */ private void renderLine(final ParameterizedPolyline line) { if (line.getPointCount() < 2) { logger.warn("Line has " + line.getPointCount() + " points and cannot be rendered"); return; } this.texture.initializeRendering(); this.texture.setRange(0., 0, line.getParameter(line.getPointCount() - 1), 1); // System.err.println("set range to " + this.texture.getMinX() + "x" + this.texture.getMinY() + " - " + this.texture.getMaxX() + "x" // + this.texture.getMaxY()); /** * p1 is the nth point, n1 the segment normal at p1 point * p2 is the (n+1)th point, n2 the segment normal at p2 point * * pXa, pXb are the */ Point2d p1 = line.getPoint(0); // nth point double p1t = line.getParameter(0); Point2d p2 = line.getPoint(1); // n+1 th point double p2t = line.getParameter(1); Point2d p3 = null; // n+2 th point Vector2d v1 = MathUtil.vector(p1, p2); // line direction at p1 Vector2d v2 = null; // line direction at p2 Vector2d n1 = MathUtil.computeNormal(v1); // line normal at p1 (perpendicular to segment direction) Vector2d n2 = null; // line normal at p2 (perpendicular to segment direction) Point2d p1a = MathUtil.pointOfLine(p1, n1, -this.getLineWidth() / 2); // first stretched point at p1 (p1 + lineWidth/2 * n1) Point2d p1b = MathUtil.pointOfLine(p1, n1, this.getLineWidth() / 2); // second stretched point at p1 (p1 - lineWidth/2 * n1) Point2d p2a = null; // first stretched point at p2 (p2 + lineWidth/2 * n2) Point2d p2b = null; // second stretched point at p2 (p2 - lineWidth/2 * n2) if (line.getPointCount() <= 2) { p3 = p2; n2 = n1; } GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GL11.glBegin(GL11.GL_QUAD_STRIP); try { GL11.glTexCoord2d(p1t, 0); GLTools.glTexCoord(this.texture.vertexCoordinates(p1t, 0)); GL11.glVertex2d(p1a.x, p1a.y); GLTools.glTexCoord(this.texture.vertexCoordinates(p1t, 1)); GL11.glVertex2d(p1b.x, p1b.y); // System.err.println("set first point coordinates = " + p1t + "x" + "0" + " => " + this.texture.vertexCoordinates(p1t, 0)); // System.err.println("set first point coordinates = " + p1t + "x" + "1" + " => " + this.texture.vertexCoordinates(p1t, 1)); for (int nPoint = 0; nPoint < line.getPointCount() - 2; nPoint++) { p3 = line.getPoint(nPoint + 2); v2 = MathUtil.vector(p2, p3); n2 = MathUtil.computeNormal(v2); p2a = MathUtil.pointOfLine(p2, n2, -this.getLineWidth() / 2); p2b = MathUtil.pointOfLine(p2, n2, this.getLineWidth() / 2); p2t = line.getParameter(nPoint); Point2d Ia = MathUtil.intersectionPoint(p1a, v1, p2a, v2); Point2d Ib = MathUtil.intersectionPoint(p1b, v1, p2b, v2); if (Ia == null || Ib == null) { Ia = MathUtil.mean(p1a, p2a); Ib = MathUtil.mean(p1b, p2b); } GLTools.glTexCoord(this.texture.vertexCoordinates(p2t, 0)); GL11.glVertex2d(Ia.x, Ia.y); GLTools.glTexCoord(this.texture.vertexCoordinates(p2t, 1)); GL11.glVertex2d(Ib.x, Ib.y); // System.err.println("set #" + nPoint + " point coordinates = " + p2t + "x" + "0" + " => " + this.texture.vertexCoordinates(p2t, 0)); // System.err.println("set #" + nPoint + " point coordinates = " + p2t + "x" + "1" + " => " + this.texture.vertexCoordinates(p2t, 1)); // shift context to the next point p1 = p2; p1t = p2t; n1 = n2; v1 = v2; p1a = Ia; p1b = Ib; p2 = p3; } // draw the last point Point2d p3a = MathUtil.pointOfLine(p3, n2, -this.getLineWidth() / 2); Point2d p3b = MathUtil.pointOfLine(p3, n2, this.getLineWidth() / 2); double p3t = line.getParameter(line.getPointCount() - 1); GLTools.glTexCoord(this.texture.vertexCoordinates(p3t, 0)); GL11.glVertex2d(p3a.x, p3a.y); GLTools.glTexCoord(this.texture.vertexCoordinates(p3t, 1)); GL11.glVertex2d(p3b.x, p3b.y); // System.err.println("set last point coordinates = " + p3t + "x" + "0" + " => " + this.texture.vertexCoordinates(p3t, 0)); // System.err.println("set last point coordinates = " + p3t + "x" + "1" + " => " + this.texture.vertexCoordinates(p3t, 1)); } finally { GL11.glEnd(); } this.texture.initializeRendering(); }
From source file:fr.ign.cogit.geoxygene.appli.render.primitive.LinePrimitiveRenderer.java
License:Open Source License
/** * Render simple line./*from w w w. j av a2 s . c o m*/ * @param primitive primitive to paint */ private void renderLineDebug(final ParameterizedPolyline line) { if (line.getPointCount() < 2) { logger.warn("Line has " + line.getPointCount() + " points and cannot be rendered"); return; } final double epsilon = 1E-1; /** * p1 is the nth point, n1 the segment normal at p1 point * p2 is the (n+1)th point, n2 the segment normal at p2 point * * pXa, pXb are the */ Point2d p1 = line.getPoint(0); // nth point Point2d p2 = line.getPoint(1); // n+1 th point Point2d p3 = null; // n+2 th point Vector2d v1 = MathUtil.vector(p1, p2); // line direction at p1 Vector2d v2 = null; // line direction at p2 Vector2d n1 = MathUtil.computeNormal(v1); // line normal at p1 (perpendicular to segment direction) Vector2d n2 = null; // line normal at p2 (perpendicular to segment direction) Point2d p1a = MathUtil.pointOfLine(p1, n1, -this.getLineWidth() / 2); // first stretched point at p1 (p1 + lineWidth/2 * n1) Point2d p1b = MathUtil.pointOfLine(p1, n1, this.getLineWidth() / 2); // second stretched point at p1 (p1 - lineWidth/2 * n1) Point2d p2a = null; // first stretched point at p2 (p2 + lineWidth/2 * n2) Point2d p2b = null; // second stretched point at p2 (p2 - lineWidth/2 * n2) if (line.getPointCount() <= 2) { p3 = p2; n2 = n1; } double s = 1; GL11.glLineWidth(2.f); GL11.glBegin(GL11.GL_LINES); // first point GL11.glColor3d(1, 0, 0); GL11.glVertex2d(p1a.x, p1a.y); GL11.glVertex2d(p1b.x, p1b.y); try { for (int nPoint = 0; nPoint < line.getPointCount() - 2; nPoint++) { p3 = line.getPoint(nPoint + 2); v2 = MathUtil.vector(p2, p3); n2 = MathUtil.computeNormal(v2); p2a = MathUtil.pointOfLine(p2, n2, -this.getLineWidth() / 2); p2b = MathUtil.pointOfLine(p2, n2, this.getLineWidth() / 2); GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p1a.x, p1a.y); GL11.glVertex2d(p1b.x, p1b.y); /* GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p1.x, p1.y); GL11.glVertex2d(p1.x + s * v1.x, p1.y + s * v1.y); GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p1.x, p1.y); GL11.glVertex2d(p1.x + s * n1.x, p1.y + s * n1.y); */ Point2d Ia = MathUtil.intersectionPoint(p1a, v1, p2a, v2, epsilon); Point2d Ib = MathUtil.intersectionPoint(p1b, v1, p2b, v2, epsilon); // debug if (first && Ia != null && Ib != null && MathUtil.norm(MathUtil.vector(Ia, Ib)) > 100) { first = false; JDialog dialog = new JDialog(); GraphPanel graphPanel = new GraphPanel(); dialog.getContentPane().add(graphPanel); dialog.pack(); dialog.setVisible(true); graphPanel.addPoint("p1", p1); graphPanel.addPoint("p2", p2); graphPanel.addPoint("p3", p3); // graphPanel.addVector("n1", p1, n1); // graphPanel.addVector("n2", p2, n2); graphPanel.addVector("v1", p1, v1); graphPanel.addVector("v2", p1, v2); graphPanel.addVector(".", p1a, v1); graphPanel.addVector(",", p1b, v1); graphPanel.addVector("`", p2a, v2); graphPanel.addVector("'", p2b, v2); graphPanel.addPoint("p1a", p1a); graphPanel.addPoint("p1b", p1b); graphPanel.addPoint("p2a", p2a); graphPanel.addPoint("p2b", p2b); System.out.println("v1.v2 = " + MathUtil.cross(v1, v2)); // graphPanel.addPoint("Ia", Ia); // graphPanel.addPoint("Ib", Ib); System.out.println(nPoint + " on " + line.getPointCount() + " =>"); System.out.println(" p1 = " + p1); System.out.println(" p2 = " + p2); System.out.println(" p3 = " + p3); System.out.println(" n1 = " + n1); System.out.println(" n2 = " + n2); System.out.println(" v1 = " + v1); System.out.println(" v2 = " + v2); System.out.println(" p1a = " + p1a); System.out.println(" p1b = " + p1b); System.out.println(" p2a = " + p2a); System.out.println(" p2b = " + p2b); System.out.println(" Ia = " + Ia); System.out.println(" Ib = " + Ib); p3 = line.getPoint(nPoint + 2); v2 = MathUtil.vector(p2, p3); n2 = MathUtil.computeNormal(v2); p2a = MathUtil.pointOfLine(p2, n2, -this.getLineWidth() / 2); p2b = MathUtil.pointOfLine(p2, n2, this.getLineWidth() / 2); Ia = MathUtil.intersectionPoint(p1a, v1, p2a, v2, epsilon); Ib = MathUtil.intersectionPoint(p1b, v1, p2b, v2, epsilon); } if (Ia == null || Ib == null) { Ia = MathUtil.mean(p1a, p2a); Ib = MathUtil.mean(p1b, p2b); } // if no intersection, use p2a & p2b if (Ia == null) { GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p2a.x, p2b.y); } else { GL11.glColor3d(0, 0, 1); GL11.glVertex2d(Ia.x, Ia.y); } if (Ib == null) { GL11.glColor3d(.5, .5, .5); GL11.glVertex2d(p2b.x, p2b.y); } else { GL11.glColor3d(0, 1, 0); GL11.glVertex2d(Ib.x, Ib.y); } // shift context to the next point p1 = p2; n1 = n2; v1 = v2; p1a = p2a; p1b = p2b; p2 = p3; } if (p3 == null || n2 == null) { System.err.println("p3 = " + p3 + " n2 = " + n2 + " nbpt = " + line.getPointCount()); } // draw the last point Point2d p3a = MathUtil.pointOfLine(p3, n2, -this.getLineWidth() / 2); Point2d p3b = MathUtil.pointOfLine(p3, n2, this.getLineWidth() / 2); GL11.glColor3d(1, 1, 0); GL11.glVertex2d(p3a.x, p3a.y); GL11.glVertex2d(p3b.x, p3b.y); } finally { GL11.glEnd(); } }
From source file:fr.ign.cogit.geoxygene.appli.render.RenderGL11Util.java
License:Open Source License
/** * Draw a shape polygon using open GL. It can either fill the polygon or * display only// w w w. j a va 2 s . c o m * the edges. No tesselation is done when filling, so the shape has to be * simple and convex * * @param shape * Java2D shape to paint * @param close * automatically close the polygon between start and end point * @param fill * if true fills the polygon with current color. if false, draw * only edges */ private static void glDrawRawShape(final Shape shape, final boolean close, final boolean fill) { final int glDrawType = fill ? GL11.GL_POLYGON : close ? GL11.GL_LINE_LOOP : GL_LINE_STRIP; // final int glDrawType = GL11.GL_LINE_LOOP; // glLineWidth(5.f); boolean polygonStarted = false; PathIterator pathIterator = shape.getPathIterator(null); // System.err.print("polygon "); while (!pathIterator.isDone()) { float[] coords = new float[6]; int segmentType = pathIterator.currentSegment(coords); switch (segmentType) { case PathIterator.SEG_CLOSE: if (polygonStarted) { GL11.glEnd(); polygonStarted = false; } case PathIterator.SEG_MOVETO: if (polygonStarted) { GL11.glEnd(); // close the current polygon polygonStarted = false; } GL11.glBegin(glDrawType); // open a new one polygonStarted = true; GL11.glVertex2f(coords[0], coords[1]); // starting at the given position break; case PathIterator.SEG_CUBICTO: if (!polygonStarted) { GL11.glBegin(glDrawType); // start a new polygon if not already done polygonStarted = true; } GL11.glVertex2f(coords[4], coords[5]); break; case PathIterator.SEG_QUADTO: if (!polygonStarted) { GL11.glBegin(glDrawType); // start a new polygon if not already done polygonStarted = true; } GL11.glVertex2f(coords[2], coords[3]); break; case PathIterator.SEG_LINETO: if (!polygonStarted) { GL11.glBegin(glDrawType); // start a new polygon if not already done polygonStarted = true; } GL11.glVertex2f(coords[0], coords[1]); break; default: logger.warn("Draw GL shape do not know how to handle segment type " + segmentType); } // if (coords[0] != 0. || coords[1] != 0.) // System.err.print(" - " + coords[0] + "x" + coords[1]); pathIterator.next(); } if (polygonStarted) { GL11.glEnd(); polygonStarted = false; } }
From source file:fr.ign.cogit.geoxygene.appli.render.RenderGL11Util.java
License:Open Source License
/** * Draw a shape polygon using open GL. It displays only the shape edges with * colors depending on segment types.//w ww. j a va 2 s . c o m * This method has been implemented for debug purpose in order to display * different colors * for the different shape's parts. Colors are not customizable * * @param shape * Java2D shape to paint */ public static void glDrawRawShapeColoredSegment(final Shape shape) { Color closeColor = Color.blue; Color moveColor = Color.red; Color lineColor = Color.black; Color quadColor = Color.yellow; Color cubicColor = Color.pink; boolean polygonStarted = false; float startX = 0, startY = 0; float prevX = 0, prevY = 0; GL11.glBegin(GL_LINES); // start a new polygon if not already done PathIterator pathIterator = shape.getPathIterator(null); // System.err.print("polygon "); int nPoint = 0; while (!pathIterator.isDone()) { float[] coords = new float[6]; int segmentType = pathIterator.currentSegment(coords); switch (segmentType) { case PathIterator.SEG_CLOSE: if (polygonStarted) { glColor(closeColor); GL11.glVertex2f(prevX, prevY); GL11.glVertex2f(startX, startY); polygonStarted = false; } else { logger.error("Close a non open segment"); } case PathIterator.SEG_MOVETO: if (polygonStarted) { glColor(moveColor); GL11.glVertex2f(prevX, prevY); GL11.glVertex2f(coords[0], coords[1]); startX = prevX = coords[0]; startY = prevY = coords[1]; // polygonStarted = true; } else { polygonStarted = true; startX = prevX = coords[0]; startY = prevY = coords[1]; // logger.warn("move to " + startX + "x" + startY + " but polygon not started n = " + nPoint); } break; case PathIterator.SEG_CUBICTO: if (polygonStarted) { glColor(cubicColor); GL11.glVertex2f(prevX, prevY); GL11.glVertex2f(coords[4], coords[5]); prevX = coords[4]; prevY = coords[5]; } else { polygonStarted = true; startX = prevX = coords[4]; startY = prevY = coords[5]; } break; case PathIterator.SEG_QUADTO: if (polygonStarted) { glColor(quadColor); GL11.glVertex2f(prevX, prevY); GL11.glVertex2f(coords[2], coords[3]); prevX = coords[2]; prevY = coords[3]; } else { polygonStarted = true; startX = prevX = coords[2]; startY = prevY = coords[3]; } break; case PathIterator.SEG_LINETO: if (polygonStarted) { glColor(lineColor); GL11.glVertex2f(prevX, prevY); GL11.glVertex2f(coords[0], coords[1]); prevX = coords[0]; prevY = coords[1]; if (nPoint == 1) { logger.debug("First line point = " + prevX + "x" + prevY); } } else { polygonStarted = true; startX = prevX = coords[0]; startY = prevY = coords[1]; } break; default: logger.warn("Draw GL shape do not know how to handle segment type " + segmentType); } // if (coords[0] != 0. || coords[1] != 0.) // System.err.print(" - " + coords[0] + "x" + coords[1]); pathIterator.next(); } GL11.glEnd(); }
From source file:fr.ign.cogit.geoxygene.util.gl.GLTools.java
License:Open Source License
public static void glDrawString(final String s, double x, double y) { double startX = x; GL11.glBegin(GL11.GL_POINTS); for (char c : s.toLowerCase().toCharArray()) { if (c == 'a') { for (int i = 0; i < 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); }//from w w w. jav a2s . c o m for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - 4); } x += 8; } else if (c == 'b') { for (int i = 0; i < 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + i, y); GL11.glVertex2d(x + i, y - 4); GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 7, y - 5); GL11.glVertex2d(x + 7, y - 7); GL11.glVertex2d(x + 7, y - 6); GL11.glVertex2d(x + 7, y - 1); GL11.glVertex2d(x + 7, y - 2); GL11.glVertex2d(x + 7, y - 3); x += 8; } else if (c == 'c') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y); GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 6, y - 1); GL11.glVertex2d(x + 6, y - 2); GL11.glVertex2d(x + 6, y - 6); GL11.glVertex2d(x + 6, y - 7); x += 8; } else if (c == 'd') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y); GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 6, y - 1); GL11.glVertex2d(x + 6, y - 2); GL11.glVertex2d(x + 6, y - 3); GL11.glVertex2d(x + 6, y - 4); GL11.glVertex2d(x + 6, y - 5); GL11.glVertex2d(x + 6, y - 6); GL11.glVertex2d(x + 6, y - 7); x += 8; } else if (c == 'e') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + i, y - 0); GL11.glVertex2d(x + i, y - 8); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 4); } x += 8; } else if (c == 'f') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + i, y - 8); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 4); } x += 8; } else if (c == 'g') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y); GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 6, y - 1); GL11.glVertex2d(x + 6, y - 2); GL11.glVertex2d(x + 6, y - 3); GL11.glVertex2d(x + 5, y - 3); GL11.glVertex2d(x + 7, y - 3); GL11.glVertex2d(x + 6, y - 6); GL11.glVertex2d(x + 6, y - 7); x += 8; } else if (c == 'h') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 4); } x += 8; } else if (c == 'i') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 3, y - i); } for (int i = 1; i <= 5; i++) { GL11.glVertex2d(x + i, y - 0); GL11.glVertex2d(x + i, y - 8); } x += 7; } else if (c == 'j') { for (int i = 1; i <= 8; i++) { GL11.glVertex2d(x + 6, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 0); } GL11.glVertex2d(x + 1, y - 3); GL11.glVertex2d(x + 1, y - 2); GL11.glVertex2d(x + 1, y - 1); x += 8; } else if (c == 'k') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } GL11.glVertex2d(x + 6, y - 8); GL11.glVertex2d(x + 5, y - 7); GL11.glVertex2d(x + 4, y - 6); GL11.glVertex2d(x + 3, y - 5); GL11.glVertex2d(x + 2, y - 4); GL11.glVertex2d(x + 2, y - 3); GL11.glVertex2d(x + 3, y - 4); GL11.glVertex2d(x + 4, y - 3); GL11.glVertex2d(x + 5, y - 2); GL11.glVertex2d(x + 6, y - 1); GL11.glVertex2d(x + 7, y); x += 8; } else if (c == 'l') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + i, y); } x += 7; } else if (c == 'm') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } GL11.glVertex2d(x + 3, y - 6); GL11.glVertex2d(x + 2, y - 7); GL11.glVertex2d(x + 4, y - 5); GL11.glVertex2d(x + 5, y - 6); GL11.glVertex2d(x + 6, y - 7); GL11.glVertex2d(x + 4, y - 5); x += 8; } else if (c == 'n') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } GL11.glVertex2d(x + 2, y - 7); GL11.glVertex2d(x + 2, y - 6); GL11.glVertex2d(x + 3, y - 5); GL11.glVertex2d(x + 4, y - 4); GL11.glVertex2d(x + 5, y - 3); GL11.glVertex2d(x + 6, y - 2); GL11.glVertex2d(x + 6, y - 1); x += 8; } else if (c == 'o' || c == '0') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - 0); } x += 8; } else if (c == 'p') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - 4); } GL11.glVertex2d(x + 6, y - 7); GL11.glVertex2d(x + 6, y - 5); GL11.glVertex2d(x + 6, y - 6); x += 8; } else if (c == 'q') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); if (i != 1) { GL11.glVertex2d(x + 7, y - i); } } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 8); if (i != 6) { GL11.glVertex2d(x + i, y - 0); } } GL11.glVertex2d(x + 4, y - 3); GL11.glVertex2d(x + 5, y - 2); GL11.glVertex2d(x + 6, y - 1); GL11.glVertex2d(x + 7, y); x += 8; } else if (c == 'r') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - 4); } GL11.glVertex2d(x + 6, y - 7); GL11.glVertex2d(x + 6, y - 5); GL11.glVertex2d(x + 6, y - 6); GL11.glVertex2d(x + 4, y - 3); GL11.glVertex2d(x + 5, y - 2); GL11.glVertex2d(x + 6, y - 1); GL11.glVertex2d(x + 7, y); x += 8; } else if (c == 's') { for (int i = 2; i <= 7; i++) { GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 1, y - 7); GL11.glVertex2d(x + 1, y - 6); GL11.glVertex2d(x + 1, y - 5); for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 4); GL11.glVertex2d(x + i, y); } GL11.glVertex2d(x + 7, y - 3); GL11.glVertex2d(x + 7, y - 2); GL11.glVertex2d(x + 7, y - 1); GL11.glVertex2d(x + 1, y - 1); GL11.glVertex2d(x + 1, y - 2); x += 8; } else if (c == 't') { for (int i = 0; i <= 8; i++) { GL11.glVertex2d(x + 4, y - i); } for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + i, y - 8); } x += 7; } else if (c == 'u') { for (int i = 1; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 0); } x += 8; } else if (c == 'v') { for (int i = 2; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 6, y - i); } GL11.glVertex2d(x + 2, y - 1); GL11.glVertex2d(x + 5, y - 1); GL11.glVertex2d(x + 3, y); GL11.glVertex2d(x + 4, y); x += 7; } else if (c == 'w') { for (int i = 1; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } GL11.glVertex2d(x + 2, y); GL11.glVertex2d(x + 3, y); GL11.glVertex2d(x + 5, y); GL11.glVertex2d(x + 6, y); for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + 4, y - i); } x += 8; } else if (c == 'x') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + i, y - i); } for (int i = 7; i >= 1; i--) { GL11.glVertex2d(x + i, y - 8 + i); } x += 8; } else if (c == 'y') { GL11.glVertex2d(x + 4, y); GL11.glVertex2d(x + 4, y - 1); GL11.glVertex2d(x + 4, y - 2); GL11.glVertex2d(x + 4, y - 3); GL11.glVertex2d(x + 4, y - 4); GL11.glVertex2d(x + 3, y - 5); GL11.glVertex2d(x + 2, y - 6); GL11.glVertex2d(x + 1, y - 7); GL11.glVertex2d(x + 1, y - 8); GL11.glVertex2d(x + 5, y - 5); GL11.glVertex2d(x + 6, y - 6); GL11.glVertex2d(x + 7, y - 7); GL11.glVertex2d(x + 7, y - 8); x += 8; } else if (c == 'z') { for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + i, y); GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - i); } GL11.glVertex2d(x + 6, y - 7); x += 8; } else if (c == '1') { for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y); } for (int i = 1; i <= 8; i++) { GL11.glVertex2d(x + 4, y - i); } GL11.glVertex2d(x + 3, y - 7); x += 8; } else if (c == '2') { for (int i = 1; i <= 6; i++) { GL11.glVertex2d(x + i, y); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 1, y - 7); GL11.glVertex2d(x + 1, y - 6); GL11.glVertex2d(x + 6, y - 7); GL11.glVertex2d(x + 6, y - 6); GL11.glVertex2d(x + 6, y - 5); GL11.glVertex2d(x + 5, y - 4); GL11.glVertex2d(x + 4, y - 3); GL11.glVertex2d(x + 3, y - 2); GL11.glVertex2d(x + 2, y - 1); x += 8; } else if (c == '3') { for (int i = 1; i <= 5; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y); } for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 6, y - i); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 4); } x += 8; } else if (c == '4') { for (int i = 2; i <= 8; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 7; i++) { GL11.glVertex2d(x + i, y - 1); } for (int i = 0; i <= 4; i++) { GL11.glVertex2d(x + 4, y - i); } x += 8; } else if (c == '5') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + i, y - 8); } for (int i = 4; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); } GL11.glVertex2d(x + 1, y - 1); GL11.glVertex2d(x + 2, y); GL11.glVertex2d(x + 3, y); GL11.glVertex2d(x + 4, y); GL11.glVertex2d(x + 5, y); GL11.glVertex2d(x + 6, y); GL11.glVertex2d(x + 7, y - 1); GL11.glVertex2d(x + 7, y - 2); GL11.glVertex2d(x + 7, y - 3); GL11.glVertex2d(x + 6, y - 4); GL11.glVertex2d(x + 5, y - 4); GL11.glVertex2d(x + 4, y - 4); GL11.glVertex2d(x + 3, y - 4); GL11.glVertex2d(x + 2, y - 4); x += 8; } else if (c == '6') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y); } for (int i = 2; i <= 5; i++) { GL11.glVertex2d(x + i, y - 4); GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 7, y - 1); GL11.glVertex2d(x + 7, y - 2); GL11.glVertex2d(x + 7, y - 3); GL11.glVertex2d(x + 6, y - 4); x += 8; } else if (c == '7') { for (int i = 0; i <= 7; i++) { GL11.glVertex2d(x + i, y - 8); } GL11.glVertex2d(x + 7, y - 7); GL11.glVertex2d(x + 7, y - 6); GL11.glVertex2d(x + 6, y - 5); GL11.glVertex2d(x + 5, y - 4); GL11.glVertex2d(x + 4, y - 3); GL11.glVertex2d(x + 3, y - 2); GL11.glVertex2d(x + 2, y - 1); GL11.glVertex2d(x + 1, y); x += 8; } else if (c == '8') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); GL11.glVertex2d(x + 7, y - i); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - 0); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 4); } x += 8; } else if (c == '9') { for (int i = 1; i <= 7; i++) { GL11.glVertex2d(x + 7, y - i); } for (int i = 5; i <= 7; i++) { GL11.glVertex2d(x + 1, y - i); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 8); GL11.glVertex2d(x + i, y - 0); } for (int i = 2; i <= 6; i++) { GL11.glVertex2d(x + i, y - 4); } GL11.glVertex2d(x + 1, y - 0); x += 8; } else if (c == '.') { GL11.glVertex2d(x + 1, y); x += 2; } else if (c == ',') { GL11.glVertex2d(x + 1, y); GL11.glVertex2d(x + 1, y - 1); x += 2; } else if (c == '\n') { y -= 10; x = startX; } else if (c == ' ') { x += 8; } } GL11.glEnd(); }