Jump to content

[SOLVED] Multiple UNIGINE QWidgets in Single C++ QT Application


photo

Recommended Posts

Posted

I would like to integrate UNIGINE into a QT C++ GUI application base on provided sample code for UNIGINE D3D9AppQt widget.

 

Is it possible to have multiple UNIGINE QWidgets (e.g. one for 3D map, one for some other 3D diagramm) in a single QApplication at the same time or can there only be a single UNIGINE QWidget ?

Posted

Yes it's possible to make multiple QWidgets application with single engine instance.

 

You can change or override the following method:

source/samples/App/common/AppQt.cpp:77

void AppQt::paintEvent(QPaintEvent *event);

 

And call Unigine::Render::renderViewport() or Unigine::Render::renderNode() functions with arbitrary projections and masks inside it.

Posted

Thanks frustum ! Still I don't understand how this can work if the different UNIGINE QWidgets have different sizes e.g. when they are child windows of some other parent Qt main window and the user can change individual QWidget window sizes and they are shown at the same time as independent views ? As far as I understand the integration the UNIGINE engine instance can only support one render window size. Any clarification highly welcome.

 

Otherwise usage of Unigine::Render::renderImage2D() might be a work-around and also the rendered image could be used for Qt-side render image buffering and fast image blitting in case of paint events when the 3D scene hasn't change (so I could avoid useless rendering of 30 FPS when there is no need and save the time for Qt-side processing e.g. database query or user interaction)

Posted

Each D3D9Widget must have own SwapChain with arbitrary size and engine will render into this widgets via Unigine::Render::renderViewport() function.

Another good example of multi-window rendering is source/plugins/Interface/ plugin. InterfaceWindow.cpp creates additional swap chain on 155 line.

×
×
  • Create New...