ulf.schroeter Posted November 17, 2012 Posted November 17, 2012 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 ?
frustum Posted November 17, 2012 Posted November 17, 2012 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.
ulf.schroeter Posted November 17, 2012 Author Posted November 17, 2012 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)
frustum Posted November 17, 2012 Posted November 17, 2012 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.
Recommended Posts