Jump to content

[SOLVED] Migration 2.7 to 2.8


photo

Recommended Posts

Hi,

we want to migrate from 2.7 to 2.8 to keep our code base up to date.
We did replace all the API changes, but our application cannot initalize the Engine anymore.
From the debugger I can see, that it never returns from the AsyncGPUThread::run method.
Our product is  already using QOpenGLWidget which needs compatibility context of OpenGL for QWidget composition to render alpha blended widgets on top. Context version is 4.6.
We are managing OpenGL contexts by ourself, because we also need to support legacy libs, which use immediate opengl code.
The Unigine Engine runs in own QThread to keep our user interface responsive.
The current code works perfectly with 2.6 and 2.7 version of the engine.
In the attachment are some log files and console output of our application.
Thanks in advance for your help.

Regards,
Sebastian

Our Code:

m_renderContext = renderContext; //Own render context interface, implements shared QOpenGLContext context 4.6 compatibility context
	m_renderContext->bind();

	//Create/get unigine app combined with different windows
	m_ungineAppHandle = std::make_unique<CustomUnigineApp>(); //Custom App derive from Unigine App interface, implements basic inputs
	m_ungineAppHandle->setWidth(1920);// just initialize things, windows size will be changed later
	m_ungineAppHandle->setHeight(1080);
	switch (renderContext->api()) {
	case RenderContext::Api::Opengl:
		m_ungineAppHandle->initGL(m_ungineAppHandle->getGLContext());// copied from qml example, getGLContext returns null but this line must somehow be important, not overridden
		break;
	default:
		return;
	}

	const char *args[] = {
		"-data_path", profileFolder.c_str(),
		"-engine_config", "ig.cfg"
	};

	//Initialize the unigine engine with with arguments, version and app handle, assuming the function will never actually modify args
	m_engine = Unigine::Engine::init(UNIGINE_VERSION, m_ungineAppHandle.get(), 4, const_cast<char**>(args)); //The Application never returns from this function, worked in version 2.7.3

Console output 2.8:

<ourApplication.cpp (197)>: OpenGL Version: 4.6
<ourApplication.cpp (484)>: ourApplication has established all core connections
<ourApplication.cpp (537)>: ourApplication has received all data
Loading "opengl32.dll"...
OpenGL 4.5 initialization
GLExt::init(): async_context wglCreateContextAttribsARB(): failed
Loading "data/ig.cfg"...
Config::getInt(): can't find "show_fps" int item in config
Using config file "data/ig.cfg"

---- Plugins ----

---- Application ----
Loading "openal32.dll"...
video_restart

 

stack.PNG

log_2.8.html log_2.7.html

Edited by sebastian.vesenmayer
Link to comment

Hi Sebastian,

Could you please send us a small reproduction sample with your Qt application that inits OpenGL 4.6 context? It would be enough to send working and compiling code with Unignie 2.7.

Especially we are want to test following case:

Quote

We are managing OpenGL contexts by ourself, because we also need to support legacy libs, which use immediate opengl code.

That could be a real problem since threaded GL is pretty much undocumented and it's hard to find out how application will work in different cases.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi,

you can find the example in the attachment.

I did not implement user inputs and only "basic" thread syncronization, which shows that it works.

If you have any questions to setup the project do not hesitate to contact me.

Used Qt version: 5.9.2 64 bit

Used Unigine SDK version: 2.7.3

Visual Studio: 2017 with QT VS Tool Plugin

Regards,

Sebastian

VSProjects.zip

Link to comment

@sebastian.vesenmayer

Please, check the modified sources in the attachment. There are two main changes:

  1. We pass real GL context in initGL();
  2. CustomUnigineApp::getHandle() returns window that will be used to create shared context (that probably will be moved into the Engine in 2.10).

I was able to build it and run in 2.8 SDK.

VSProjects_fix.zip

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • morbid changed the title to [SOLVED] Migration 2.7 to 2.8
×
×
  • Create New...