[Interest] Sharing Shaders between contexts

Lorne Sturtevant dragor at shaw.ca
Fri Mar 13 07:08:43 CET 2015


I have a program that has two top level OpenGL widgets.  I'm having
problems creating shader programs and sharing them between the windows. 
The shaders work prefectly in one window, but not in the other. 
Previously I've used QGLWidget, but now I'm trying to upgrade it to
QOpenGLWidget.  With the old system, I had no problems sharing
everything between the top level widgets.

I'm using QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts)
before creating the QApplication.  I've also used
QOpenGLContext::areSharing() to compare the contexts and they are
supposedly being shared.

>From the documentation for QOpenGLContext, it states:  Resources, such
as framebuffer objects, textures, and vertex buffer objects can be
shared between contexts.

In that list of resources, it doesn't list shader programs.  Can they be
shared or are they treated differently?

I found this forum post
http://forum.qt.io/topic/51764/2-qopenglwidget-shared-context which is
asking the same thing I am.  Can anyone lend some insight?

-- 
Lorne Sturtevant
Sum Ergo Cogito




More information about the Interest mailing list