On 01/07/2013 08:22 PM, Pier Luigi wrote: > 2013/1/2 Samuel Rødal <samuel.ro...@digia.com>: >> On 12/28/2012 09:53 AM, Pier Luigi wrote: >>> >>> However glGetString() always return NULL, I call it from the >>> sceneGraphInitialized() slot and I noticed that despite >>> openglContext() returns a valid pointer, >>> QOpenGLContext::currentContext() is 0. >>> >>> Someone has an idea on what I'm doing wrong? >> >> On which thread do you execute the slot connected to >> sceneGraphInitialized() ? The scene graph might run on a separate thread >> from the main UI thread, and the QOpenGLContext will then be made >> current there. > > I first tried to use glGetString() from main after the compositor > creation but that should be a different thread than the rendering > thead: > > https://github.com/hawaii-desktop/greenisland/blob/master/src/greenisland/main.cpp > > Then I tried to connect the signal on the QQuickView subclass constructor to a > private slot. > The slot should be called from the rendering thread, giving me access > to the context but it doesn't seem to happen.
The QQuickView exists in the main thread, so if you want the slot that you connect to the sceneGraphInitialized() signal to be executed on the rendering thread you need to make the connection a Qt::DirectConnection by passing that as the final argument to connect. The default will otherwise be Qt::QueuedConnection and the slot will still be executed on the main thread. -- Samuel _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest