Jump to content

How to put Unigine Render Window in Qt?


photo

Recommended Posts

Posted

Dear All:

I want put Unigine Render Window in a QWidget,I find sample GLAppQt,but it just put Unigine Render Window in a QGLWidget,it means I have to use Unigine OpenGL Renderer.

Previous,I put Ogre Renderer in QWidget,whatever type of Ogre Renderer.

I want use Unigine DirectX Renderer,I aslo find D3D9AppMFC,I refer it,want put Unigine DirectX Renderer Window in QWidget.

 

Now,I have a problem,The QWidget have my Unigine Render Window,but it is just show the Qt background,it can't show Unigine Render Result,just like a empty QWidget.but the Unigine is updating.

 

Who can tell me how to put Unigine Render Window in Qt?

Thank you very much,forget my poor English.

Posted

I did it.

 

All C++ source code.

 

I found the Engine::update(),swap(),render() is very very different App::update(),swap(),render();

 

The GLAppQt and D3D9AppMFC just write:

App::update();

App::render();

App::swap();

 

It is did not work.

 

I have to write this:

Engine::update();

//Engine::render();

Engine::swap();

App::update();

App::render();

App::swap();

 

and it is render now.

 

iSpinel.

Posted

Pay attention:

Engine::render(); please do NOT use when Unigine in a QWidget.

 

when I use Engine::render() and App::render(), the QWidget is very vague.

 

when I just use Engine::render(),it can NOT render anything in QWidget.

 

The Engine::update,render,swap and App::update,render,swap is so let me confuse.

 

I don't know why.

 

why?

Posted

I have a new problem,when I use:

QMainWindow->setCentralWidget(pMyUnigineWidget);

The Unigine can not render anything in MyUnigineWidget..

 

But when I just use pMyUnigineWidget->show(); the Unigine is render in the MyUnigineWidget.

 

why?

 

 

Who can give me a mature Unigine in Qt sample????

 

Thank you very much.

Posted

Our developers will create an application that renders Unigine into QWidget with DirectX renderer.

 

Qt app should always use App::update() and other App functions, not Engine::update(). Which one to use in the application, Unigine::Engine or Unigine::App, depends on whether the engine has direct control over the main loop or not.

  • Unigine::App class is used when the engine passively waits for the app to cycle through the main loop. This is the case with Qt apps (because they are event-based and wait for the specific QEvent). The same goes for MFC application.
  • Unigine::Engine class is used when the engine cycles through the main loop by itself. This is the case with SDL apps.

You should not call both Unigine::App and Unigine::Engine functions at the same time, because it essentially messes up the main loop.

  • Like 1
Posted

Our developers will create an application that renders Unigine into QWidget with DirectX renderer.

 

Qt app should always use App::update() and other App functions, not Engine::update(). Which one to use in the application, Unigine::Engine or Unigine::App, depends on whether the engine has direct control over the main loop or not.

  • Unigine::App class is used when the engine passively waits for the app to cycle through the main loop. This is the case with Qt apps (because they are event-based and wait for the specific QEvent). The same goes for MFC application.
  • Unigine::Engine class is used when the engine cycles through the main loop by itself. This is the case with SDL apps.

You should not call both Unigine::App and Unigine::Engine functions at the same time, because it essentially messes up the main loop.

 

Thank you very much.

 

But I have to use like this:

 

App::update();

App::render();

App::swap();

Engine::swap();

 

If don't use"Engine::swap()",it is did NOT render anything.

  • 3 weeks later...
Posted

Qt applications with DirectX renderer are ready, check them in the newest SDK :)

×
×
  • Create New...