List of usage examples for org.lwjgl.opengl GL11 glLineWidth
public static void glLineWidth(@NativeType("GLfloat") float width)
From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { GL11.glLineWidth(thickness); GL11.glPointSize(thickness * 0.9f);// ww w. j av a2s .c o m if (renderMode == RenderMode.SOLID) { innerRadius = 0.9f * radius; drawSolidCircle(); } else { //glu.gluPartialDisk(qobj, 0, radius, quality, 4, 0, 360); if (innerRadius == 0) { drawCircle(); } else { drawExternCircle(); } } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DLine.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { GL11.glLineWidth(thickness); GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINES);//www. ja v a 2 s. c o m GL11.glVertex3d(locationA.x, locationA.y, locationA.z); GL11.glVertex3d(locationB.x, locationB.y, locationB.z); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygon.java
License:Open Source License
private void displaySolidPolygon() { GL11.glLineWidth(thickness); GL11.glBegin(GL11.GL_LINES);/*from w w w . ja v a2 s. c om*/ for (int j = 0; j < pointListList.size(); j++) { List<V3DVect3> pointList = pointListList.get(j); for (int i = 0; i < pointList.size(); i++) { if (i == 0) { drawLine(pointList.get(pointList.size() - 1), pointList.get(i)); } else { drawLine(pointList.get(i - 1), pointList.get(i)); } } } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygonWalls.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (renderMode == RenderMode.PLAIN) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS);/* w w w .ja v a2 s . com*/ for (int i = 0; i < pointList.size(); i++) { if (i == 0) { drawQuad(pointList.get(pointList.size() - 1), pointList.get(i)); } else { drawQuad(pointList.get(i - 1), pointList.get(i)); } } GL11.glEnd(); GL11.glDisable(GL11.GL_LIGHTING); } if (renderMode == RenderMode.SOLID) { GL11.glLineWidth(thickness); GL11.glBegin(GL11.GL_LINES); for (V3DVect3 point : pointList) { float z0 = -height / 2; float z1 = height / 2; GL11.glVertex3d(point.x, point.y, z1); GL11.glVertex3d(point.x, point.y, z0); } GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DRectangle.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { float x0 = -size.x / 2; float y0 = -size.y / 2; float x1 = size.x / 2; float y1 = size.y / 2; GL11.glLineWidth(thickness); if (renderMode == RenderMode.SOLID) { GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, 0);//from w w w. ja va 2 s . c o m GL11.glVertex3d(x0, y0, 0); GL11.glVertex3d(x1, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); } else { GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d(x0, y0, 0); GL11.glVertex3d(x1, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DTriangle.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { float x0 = -size.x / 2; float y0 = -size.y / 2; float x1 = size.x / 2; float y1 = size.y / 2; GL11.glLineWidth(thickness); if (renderMode == RenderMode.SOLID) { GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, 0);// w w w .jav a 2s . c o m GL11.glVertex3d((x1 + x0) / 2, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); } else { GL11.glBegin(GL11.GL_TRIANGLES); GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d((x1 + x0) / 2, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DTube.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (renderMode == RenderMode.PLAIN) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS);/*from ww w. j a v a 2 s . co m*/ for (int i = 0; i < pointList.size(); i++) { if (i == 0) { drawQuad(pointList.get(pointList.size() - 1), pointList.get(i)); } else { drawQuad(pointList.get(i - 1), pointList.get(i)); } } GL11.glEnd(); GL11.glDisable(GL11.GL_LIGHTING); } if (renderMode == RenderMode.SOLID) { GL11.glLineWidth(thickness); GL11.glBegin(GL11.GL_LINES); for (V3DVect3 point : pointList) { float z0 = -height / 2; float z1 = height / 2; GL11.glVertex3d(point.x, point.y, z1); GL11.glVertex3d(point.x, point.y, z0); } GL11.glEnd(); } /* Dessine des normales sur les sommets en gradients de couleurs GL11.glLineWidth(thickness); GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.GLLineStipple(1, (short) 0xFFFF); GL11.glPushAttrib(GL11.GL_COLOR); GL11.glBegin(GL11.GL_LINES); for (int i = 0; i < pointList.size(); i++) { drawNorm( pointList.get(i), radius * 0.6f); } GL11.glPopAttrib(); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); */ }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void setLineThickness() { float thickness = buffer.getFloat(); GL11.glLineWidth(thickness); // System.err.println("glLineWidth " + thickness); }
From source file:fr.ign.cogit.geoxygene.appli.render.primitive.LinePrimitiveRenderer.java
License:Open Source License
/** * Render simple line./*from ww w . j a v a2 s .com*/ * @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.primitive.MillPrimitiveRenderer.java
License:Open Source License
/** * Render one drawing primitive//from w w w. j a v a2s . com * @param primitive * @throws RenderingException */ private void render(final DrawingPrimitive primitive) throws RenderingException { // TODO: create a class PrimitiveManipulatorEngine that do the job // compute parameter value to cut in world space coordinates double stroke = 5 * this.getViewport().getScale(); // ResamplerOperator resampler = new ResamplerOperator(0.5); CutterOperator cutter = new CutterOperator(15, 10); try { cutter.addInput(primitive); } catch (InvalidOperatorInputException e) { throw new RenderingException(e); } DrawingPrimitive resultingPrimitive = cutter.apply(); RotateOperator rotator = new RotateOperator(Math.PI / 4.); try { rotator.addInput(resultingPrimitive); } catch (InvalidOperatorInputException e) { throw new RenderingException(e); } resultingPrimitive = rotator.apply(); GL11.glColor3f(0.f, 0.f, 0.f); GL11.glLineWidth(1.f); this.chainedRenderer.removeAllPrimitives(); this.chainedRenderer.addPrimitive(resultingPrimitive); this.chainedRenderer.render(); // GLPrimitivePointRenderer pointRenderer = new GLPrimitivePointRenderer(); // pointRenderer.setViewport(this.getViewport()); // // pointRenderer.removeAllPrimitive(); // pointRenderer.addPrimitive(primitive); // pointRenderer.render(); }