# GLVisualize - primitives

**URL:** <https://discourse.julialang.org/t/glvisualize-primitives/1485>\
**Category:** Visualization\
**Tags:** glvisualize\
**Created:** [January 14, 2017, 6:38pm UTC](https://discourse.julialang.org/t/glvisualize-primitives/1485 "2017-01-14T18:38:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2017, 6:38pm UTC](https://discourse.julialang.org/t/glvisualize-primitives/1485/1 "2017-01-14T18:38:39Z")

</div>

Hello,

which primitives are there in GLVisualize?  
I found spheres and lines, but is there also a cylinder primitive?  
I would like to port some code from cgkit (Python) to Julia. They have  
a lot of primitives:  
[http://cgkit.sourceforge.net/doc2/worldobjects.html](http://cgkit.sourceforge.net/doc2/worldobjects.html)

Any comments welcome.

Uwe

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 15, 2017, 1:53pm UTC](https://discourse.julialang.org/t/glvisualize-primitives/1485/2 "2017-01-15T13:53:07Z")

</div>

Hi Uwe,  
these are the currently supported primitives:  
[https://github.com/JuliaGeometry/GeometryTypes.jl/](https://github.com/JuliaGeometry/GeometryTypes.jl/)

Them being support only means, that they have a type representing their structure, and that functions are defined on them to build up a triangle mesh.  
In GeometryTypes, that means for them to be decomposable. I should have this in the developer docs.  
Let me take the chance to add this:  
[https://github.com/JuliaGeometry/GeometryTypes.jl/blob/master/README.md#displaying-primitives](https://github.com/JuliaGeometry/GeometryTypes.jl/blob/master/README.md#displaying-primitives)

Best,  
Simon

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 15, 2017, 2:50pm UTC](https://discourse.julialang.org/t/glvisualize-primitives/1485/3 "2017-01-15T14:50:31Z")

</div>

Thanks for the links!

I did not find any cylinder primitive. What would be the best way to implement a shaded cylinder?

Uwe

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 15, 2017, 3:21pm UTC](https://discourse.julialang.org/t/glvisualize-primitives/1485/4 "2017-01-15T15:21:04Z")

</div>

Yes, it’s not implemented yet.  
You’ll need to add a Cylinder type and implement decompose for points and faces as described. PRs for GeometryTypes would be much appreciated 🙂

Then this should work:

```nohighlight
_view(visualize(GLNormalMesh(Cylinder(...))))

```

You will see that it will look a bit strange, since the normals are generated in a silly way. So you should also implement decompose for the Normal type.

As a stop gap solution, you could just find a cylinder mesh in form of e.g. an `.obj`, load it with FileIO and just scale it to your desired size 😉

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 15, 2017, 8:56pm UTC](https://discourse.julialang.org/t/glvisualize-primitives/1485/5 "2017-01-15T20:56:40Z")

</div>

I opened an issue and suggest to continue the discussion there:  
[https://github.com/JuliaGeometry/GeometryTypes.jl/issues/71](https://github.com/JuliaGeometry/GeometryTypes.jl/issues/71)
