yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #04022
Re: 3d view output
What's more, I also want to know how to zoom the view automatically
by adding some codes in GLViewer.cpp file? For instance, I want my
model always be shown in the same size as the view.
Hi Tao, there is a functionality to save & load the 3d view
configuration (using the keys Alt-7,8,9 and 7,8,9 to save/load, and
Alt-S to save to file I think), and one can also handle that from
scripts. They key is to understand that the GL rendering happens in 2
places, one is qt.OpenGLRenderer, the other one is qt.GLViewer (which
you can retrive by calling qt.views()[0] IIRC). I will write you a
proper answer tomorrow, you can have a look in docs for now.
Hi Tao, sorry for late reply. I fixed the docs so that the python
interface to the glviewer is properly documented now
(https://www.yade-dem.org/sphinx/yade.qt.html ; note that the
yade.qt._GLViewer is itself imported directly to yade.qt, so you never
have to specify _GLViewer). You can save views with Alt+7,8,9 and load
it by pressing 7,8,9 again (press "h" in the view to get some terse help
on that); those 3 states are saved in scene and can be saved/loaded
programatically via loadState(num)/saveState(num). The viewer object can
be obtained either when you create it with v=qt.View(), or when already
opened, with v=qt.views()[0].
Then use v.loadState(1), v.saveState(2) etc. Individual parameters can
be also manipulated, see
https://www.yade-dem.org/sphinx/yade.qt.html#yade.qt._GLViewer.GLViewer
, also get some inspiration in scripts/test/beam-l3geom.py where the
view is set "by hand".
The GLViewer determines how do you look the scene, whereas
OpenGLRenderer determines what is actually drawn in the 3d space
(whether you see particles, or interactions etc); for that, see
https://www.yade-dem.org/sphinx/yade.wrapper.html#yade.wrapper.OpenGLRenderer,
which is also accessible from the second tab of the Controller (In
there, you also have access to all Gl1_* functors and their attributes).
You can get the renderer (there is only one instance of it) from
qt.Renderer() and then play with that.
Hope this help a bit.
Cheers, v.
Follow ups
References