@@ -211,7 +211,8 @@ void GlyphGeom::addArrow(const Point& p1, const Point& p2, double radius, double
211211 Point mid ((p1.x () * ratio + p2.x () * (1 - ratio)), (p1.y () * ratio + p2.y () * (1 - ratio)), (p1.z () * ratio + p2.z () * (1 - ratio)));
212212
213213 generateCylinder (p1, mid, radius / 6.0 , radius / 6.0 , resolution, color1, color2);
214- generateCylinder (mid, p2, radius, 0.0 , resolution, color1, color2);
214+ generateCone (mid, p2, radius, resolution, false , color1, color2);
215+ // generateCylinder(mid, p2, radius, 0.0, resolution, color1, color2);
215216}
216217
217218void GlyphGeom::addSphere (const Point& p, double radius, int resolution, const ColorRGB& color)
@@ -302,7 +303,7 @@ void GlyphGeom::generateCylinder(const Point& p1, const Point& p2, double radius
302303 Vector p;
303304 for (int strips = 0 ; strips <= num_strips; strips++)
304305 {
305- uint32_t offset = static_cast <uint32_t >(numVBOElements_);
306+ size_t offset = static_cast <size_t >(numVBOElements_);
306307 p = std::cos (2 . * M_PI * strips / num_strips) * u +
307308 std::sin (2 . * M_PI * strips / num_strips) * crx;
308309 p.normalize ();
@@ -340,7 +341,7 @@ void GlyphGeom::generateCone(const Point& p1, const Point& p2, double radius,
340341 Vector u = Cross (crx, n).normal ();
341342
342343 // Center of base
343- uint32_t base_index = numVBOElements_;
344+ size_t base_index = numVBOElements_;
344345 int points_per_loop = 2 ;
345346 if (renderBase)
346347 {
@@ -354,8 +355,10 @@ void GlyphGeom::generateCone(const Point& p1, const Point& p2, double radius,
354355 // Precalculate
355356 double length = (p2-p1).length ();
356357 double strip_angle = 2 . * M_PI / resolution;
358+ size_t offset = static_cast <size_t >(numVBOElements_);
357359
358360 Vector p;
361+
359362 // Add points, normals, and colors
360363 for (int strips = 0 ; strips <= resolution; strips++)
361364 {
@@ -370,18 +373,17 @@ void GlyphGeom::generateCone(const Point& p1, const Point& p2, double radius,
370373 points_.push_back (Vector (p2));
371374 colors_.push_back (color2);
372375 normals_.push_back (normals);
376+ numVBOElements_ += 2 ;
373377
374378 if (renderBase)
375379 {
376380 points_.push_back (radius * p + Vector (p1));
377381 colors_.push_back (color1);
378382 normals_.push_back (n);
383+ numVBOElements_++;
379384 }
380385 }
381386
382- uint32_t offset = static_cast <uint32_t >(numVBOElements_);
383- numVBOElements_ += resolution * points_per_loop;
384-
385387 // Add indices
386388 for (int strips = offset; strips < resolution * points_per_loop + offset; strips += points_per_loop)
387389 {
@@ -427,6 +429,7 @@ void GlyphGeom::generateDisk(const Point& p1, const Point& p2, double radius1,
427429 // Precalculate
428430 double length = (p2-p1).length ();
429431 double strip_angle = 2 . * M_PI / resolution;
432+ size_t offset = static_cast <size_t >(numVBOElements_);
430433
431434 Vector p;
432435 // Add points, normals, and colors
@@ -450,11 +453,9 @@ void GlyphGeom::generateDisk(const Point& p1, const Point& p2, double radius1,
450453 points_.push_back (radius2 * p + Vector (p2));
451454 colors_.push_back (color2);
452455 normals_.push_back (-n);
456+ numVBOElements_ += 4 ;
453457 }
454458
455- uint32_t offset = static_cast <uint32_t >(numVBOElements_);
456- numVBOElements_ += resolution * points_per_loop;
457-
458459 // Add indices
459460 for (int strips = offset; strips < resolution * points_per_loop + offset; strips += points_per_loop)
460461 {
0 commit comments