Dock a figure inside another figure with different graphics rendering

6 views (last 30 days)
I have a main figure with a lot of uicontrols and graphs, some with simple animated lines, in version R2012b. The figure is rendered with zbuffer and everything looks fine. Now, I want to add a graph with a trisurface and animate it using hgtranform. It turns out that the zbuffer rendering causes the 3D animation run very slowly but if I change to opengl, it's runs fast and nice. However, many of the other graphics objects turn out looking bad with opengl. A Matlab figure can only use one type of rendering as far as I know. My question is then, is it possible to incorporate or dock another figure into the GUI figure and make it look like a plain pair of axes? No window frame, no toolbar, no menu, etc, just axes. Then I could render the docked figure as opengl and enjoy fast 3D animation simultaneously with the rest of the zbuffer rendered graphics in the main GUI figure. Can it be done? Will it last in a deployed version? I have tried the most conventional ways of improving the animation speed (fixes axes limits, reduce no of polygons, no legend,...). Thanks!

Accepted Answer

Jan on 24 May 2018
Under Windows you can use to create a figure without border. Then moving the main figure must update the position of this "sub-figure" also. But it is not trivial to fix the stacking order: You can set the "sub-figure" as top-most window, but then activating another application does not move it to the background. Without the top-most property, clicking on the main GUI let it appear in front of the "sub-figure".
I think, this is not user-friendly enough. Let the OpenGL animation run in a separate figure.
  1 Comment
Fredrik Gustavsson
Fredrik Gustavsson on 24 May 2018
Thanks for your fast reply Jan. Indeed, I have used the FEX WindowAPI function with success before, mainly for maximizing purposes, and I had forgotten about the rich palette of additional functionality. I made a test along the lines you suggested ('topmost' and 'clip') and it works very well. I get fast opengl animation in the sub-figure simultaneously with the zbuffer graphics in the main figure and I can operate the controls in the main figure without the sub-figure disappearing. Then, I also experienced the user "unfriendliness" you anticipated when, for instance, minimizing or moving the main figure or switching to another application window. It will be quite a task to try to make the sub-figure stick to the main figure like a stamp and follow its states. I accept this as an answer but will then probably abandon the idea and proceed working on improving the speed of a zbuffer rendered animation inside the main figure. Thanks again!

Sign in to comment.

More Answers (0)


Find more on Animation in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!