# Using Julia & GTK for 3D-Plots/ Visuals

**URL:** https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156
**Category:** General Usage
**Tags:** question, glvisualize, plotting, guis
**Created:** [July 31, 2017, 7:47pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156 "2017-07-31T19:47:08Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Rae](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@Rae](https://discourse.julialang.org/u/Rae)
#### Post date: [July 31, 2017, 7:47pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/1 "2017-07-31T19:47:08Z")

</div>

Hi All!

I’m currently working on a building a GUI using Julia & GTK, but I would like to display 3D-plots and 3D visuals (animations or CAD models) to my GUI. How can I display these visuals onto my GUI?

Many Thanks,  
Rae

---

<div class="post-metadata">

### Author: ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)
#### Post date: [July 31, 2017, 8:52pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/2 "2017-07-31T20:52:24Z")

</div>

ping @sdanisch 🙂

---

<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: [August 1, 2017, 9:13am UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/3 "2017-08-01T09:13:16Z")

</div>

Yes, [GLVisualize](https://github.com/JuliaGL/GLVisualize.jl/) can in theory be used for that…  
It offers already quite a few GUI options even without GTK.  
GTK support is on it’s way, but best would be if I just release [Visualize.jl](https://github.com/SimonDanisch/Visualize.jl), which already has GTK support - but not all features from GLVisualize.jl yet.  
I’m working on this, but need to find time and prioritize other projects right now ☹

---

<div class="post-metadata">

### Author: ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)
#### Post date: [August 1, 2017, 10:15am UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/4 "2017-08-01T10:15:04Z")

</div>

It would be great if it could be integrate into Immerse.jl (figure manager + interactivity), you can even put the figures in a `GtkNotebook` and you have a pretty decent plotting system.

It uses Gadfly at the moment but I guess it wouldn’t be too hard to have something where you can switch the backend. Basically “Plottify” Immerse.

---

<div class="post-metadata">

### Author: ![barche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barche/32/79_2.png) [@barche](https://discourse.julialang.org/u/barche)
#### Post date: [August 1, 2017, 10:31am UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/5 "2017-08-01T10:31:45Z")

</div>

Just to put another option on the table, QML.jl should work with the latest GLVisualize master on 0.6 again, see the [example here](https://github.com/barche/QML.jl/blob/master/example/glvisualize.jl). It’s also possible to combine raw OpenGL directly with 2D QML elements as shown in the OpenGL Triangle example [here](https://github.com/barche/qml-juliacon2017/blob/master/QML.jl.ipynb) (QML [here](https://github.com/barche/qml-juliacon2017/blob/master/qml/opengl.qml)).

---

<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: [August 1, 2017, 10:40am UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/6 "2017-08-01T10:40:16Z")

</div>

> [@jonathanBieler](#):
>
> It would be great if it could be integrate into Immerse.jl (figure manager + interactivity), you can even put the figures in a GtkNotebook and you have a pretty decent plotting system.

Well, as nice as Immerse.jl is, it’s not really 3d ☹

---

<div class="post-metadata">

### Author: ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)
#### Post date: [August 1, 2017, 11:15am UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/7 "2017-08-01T11:15:49Z")

</div>

I mean integrating Visualize.jl with Immerse (as an optional backend). Basically you would have the plotting layer with Gtk-compatible backends (Gadfly, Visualize, GR, …), then the figures/interactivity layer with Immerse (or another package), and finally applications can use the whole thing this as a widget.

---

<div class="post-metadata">

### Author: ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)
#### Post date: [August 1, 2017, 6:47pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/8 "2017-08-01T18:47:55Z")

</div>

I am not fully sure if we need yet another layer with different backends. More important is a proper integration with Gtk. I use the combination Winston+Gtk which works absolutely smoothly since Winston just uses Cairo in its backend. This covers 1D graphs and plotting 2D images quite well. If Vizualize.jl will handle this in the future this would be great but for me it would be more important if Visualize.jl could fill the missing gap of 3D visualization that is currently missing.

I have not used Immerse so far but some interactive feature would indeed pretty helpful. Currently I am doing data picking on the Cairo surface to get some interactivity.

---

<div class="post-metadata">

### Author: ![Loic\_Chappaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loic_chappaz/32/1121_2.png) [@Loic\_Chappaz](https://discourse.julialang.org/u/Loic_Chappaz)
#### Post date: [August 1, 2017, 8:32pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/9 "2017-08-01T20:32:05Z")

</div>

So, correct me if I am wrong – and I would love to be – but there isn’t a widget or any straight forward way to include a 3D plot in a Gtk GUI, using any of the current Julia plotting packages?  
@sdanisch @tim.holy @tobias.knopp

---

<div class="post-metadata">

### Author: ![Loic\_Chappaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loic_chappaz/32/1121_2.png) [@Loic\_Chappaz](https://discourse.julialang.org/u/Loic_Chappaz)
#### Post date: [August 1, 2017, 9:02pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/10 "2017-08-01T21:02:28Z")

</div>

Is there a way to use Gtk.GtkGLArea widget as a container for a GLVisualize rendering?  
In GLVisualize, one creates a window with glscreen(), can it be piped into the Gtk widget?

---

<div class="post-metadata">

### Author: ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)
#### Post date: [August 1, 2017, 9:16pm UTC](https://discourse.julialang.org/t/using-julia-gtk-for-3d-plots-visuals/5156/11 "2017-08-01T21:16:37Z")

</div>

GLVisualize.jl is tight to GLFW. But as @sdanisch indicated above he has already integrated Visualize.jl with Gtk. I am also very eager to see a code example of this 🙂

One issue with GtkGLArea will be that it was not supported on OS X last time I tried. But this might be a general issue with Apple not supporting OpenGL anymore…
