Jump to content

OpenGL native context


photo

Recommended Posts

Hi,

we currently try to use the unigine render context to render a external symbology to a texture within the same graphics context. To achive this we need to get the current context of the Unigine Render engine. We've tried to use the Unigine::RenderContext class by getting it from the App like this.

App::get()->getGLContext()

We've been also able to get the ogengl name of that context and the void* returned is not null.

We currently have trouble interpreting the return value, as there is no further information. In a current setup that we use, we use glfw in the backend that allows to access the native contexts via the following methods for Linux and Windows. The methods

  glfwGetGLXContext

and

glfwGetWGLContext

described here

https://www.glfw.org/docs/latest/group__native.html

define the interface that we currently would expect.

Is there already something in Unigine that we could use to access the native OS's rendering context?

 

Best regards

Florian

Link to comment

Hello,

App::getGLContext returns HGLRC for Windows and GLXContext for Linux. So you can cast it back from void* and get appropriate handle.

  • Like 1
Link to comment

Hi, after a little deeper investigation the current problem actually isn't the OpenGLContext, but the QGuiApplication that is constructed in the backend. Whenever calling

#include <UnigineEngine.h>
#include <UnigineApp.h>

#include "AppEditorLogic.h"
#include "AppSystemLogic.h"
#include "AppWorldLogic.h"
#include <QApplication>

#ifdef _WIN32
    int wmain(int argc, wchar_t *argv[])
#else
    int main(int argc, char *argv[])
#endif
{
    QApplication app(argc, argv);

the QApplication Constructor like in the example above. It terminates with an SEGFAULT and the coredump points to:

QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) ()
   from /home/user/projects/Unigine/IG_Test2/bin/libQt5XcbQpa.so.5

with no further information. Do you maybe know a solution or a cause for this behaviour?

Thanks a lot!

Link to comment
×
×
  • Create New...