Ok, I can live with the dummy offscreen surface, it seems to work OK at least.
I have now tried to create a multisample FBO for blitting into the PBuffer, but it's not entirely straight forward it seems :-) What I've done is this: QOpenGLFramebufferObjectFormat format; format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); format.setSamples(4); gl_fbo_ = new QOpenGLFramebufferObject(fbo_size, format); ... gl_fbo_->bind(); .. render stuff... gl_fbo_->release(); QImage img(gl_fbo_->toImage()); // For debugging img.save("fbo_test.png"); gl_context_->makeCurrent(gl_dummy_surface_); eglMakeCurrent(egl_display_, egl_pbuffer_, egl_pbuffer_, egl_context_); QOpenGLFramebufferObject::blitFramebuffer(NULL, gl_fbo_); The "fbo_test.png" image contains the OpenGL scene as it should, but the PBuffer remains black. Any ideas? - Thomas On Tue, Sep 29, 2015 at 4:30 PM, Agocs Laszlo <laszlo.ag...@theqtcompany.com > wrote: > Well, there’s no nice solution since QOffscreenSurface is backed by a > window, not a pbuffer on Windows. (arguably this should be changed in some > future release, for ANGLE at least, but that won’t help you now) > > > > You can make a QOpenGLContext current with a QOffscreenSurface, then call > eglMakeCurrent directly with the pbuffer surface and the EGLContext you > dig out from the QOpenGLContext. This way Qt’s tracking will be correct > (when it comes to the current QOpenGLContext) too. > > > > This is apparently exactly what you are doing already. > > > > As for the multisample issues, it could be that multisampling is not > supported for pbuffers. As a workaround you could render into an FBO with a > multisample renderbuffer (assuming that’s supported) and then blit that > into the default framebuffer (FBO 0) of the pbuffer surface. > > > > BR, > > Laszlo > > *From:* interest-bounces+laszlo.agocs=theqtcompany....@qt-project.org > [mailto:interest-bounces+laszlo.agocs=theqtcompany....@qt-project.org] *On > Behalf Of *Thomas Sevaldrud > *Sent:* 29. september 2015 15:24 > *To:* Interest@qt-project.org > *Subject:* Re: [Interest] Setting current QOpenGLContext with an > EGLContext > > > > 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 <tho...@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 > > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest