[Interest] Setting current QOpenGLContext with an EGLContext

Thomas Sevaldrud thomas at silentwings.no
Tue Sep 29 15:23:49 CEST 2015


It works if I add a dummy OffscreenSurface and make my context current on
this before making the PBuffer current. Not sure if this is the best way of
doing it though?

- Thomas

On Tue, Sep 29, 2015 at 11:37 AM, Thomas Sevaldrud <thomas at silentwings.no>
wrote:

> Hi,
>
> I'm still working on the EGL PBuffer/DirectX integration through Qt that I
> posted about last week :-)
>
> Thanks to good help from this list I now have the PBuffer and DirectX
> texture set up with the share handle. I also have a QOpenGLContext which I
> have used to set up the EGL PBuffer. I don't have a QSurface though, since
> my surface is the EGL PBuffer.
>
> So, the question now is how do I make the QOpenGLContext current. (I need
> a QOpenGLContext::currentContext() for QOpenGLFunctions and so on).
>
> The code looks something like this:
>
>     glContext_ = new QOpenGLContext;
>
>     glContext_->setFormat(format);
>
>     glContext_->create();
>
>
>
>     ....
>
>
>     QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
>
>     egl_display_ = static_cast<EGLDisplay>(nativeInterface->nativeResourceForContext("eglDisplay", glContext_));
>
>     egl_context_ = static_cast<EGLContext>(nativeInterface->nativeResourceForContext("eglContext", glContext_));
>
>     EGLConfig egl_config = static_cast<EGLConfig>(nativeInterface->nativeResourceForContext("eglConfig", glContext_));
>
>
>     EGLint attribs[] = { ...
>
>
>     };
>
>     egl_pbuffer_ = eglCreatePbufferSurface(egl_display_, egl_config, attribs);
>
>
>
>     ... D3D setup stuff...
>
>
>     // Start rendering to PBuffer:
>
>
>     eglMakeCurrent(egl_display_, egl_pbuffer_, egl_pbuffer_, egl_context_);
>
>
>     ... Here I should like to set glContext current somehow...
>
>
> Any ideas?
>
>
> - Thomas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150929/f64da708/attachment.html>


More information about the Interest mailing list