[osg-users] osgviewerQT --QOSGWidget cannot create context?

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Mon Sep 8 11:43:59 PDT 2008

Hi all,

We'll probably be using Qt for our next GUI project with OSG, and so I 
started looking into the osgviewerQT example.

First of all, it seems to me that the most powerful way to use it is 
using QOSGWidget (as a base) instead of AdapterWidget, since the latter 
uses GraphicsWindowEmbedded and thus limits you to SingleThreaded mode. 
Am I right on this? Are there other factors that would influence the 
decision to use one or the other?

Now, I'm having troubles with QOSGWidget using OSG from SVN updated 
today and Qt 4.4.1 on Windows Vista (VS 8.0). Running "osgviewerQT 
--QOSGWidget cow.osg" gives me this error:

   Windows Error #2000: [Screen #0] GraphicsWindowWin32::setWindow() -
   Unable to create OpenGL rendering context. Reason: The pixel format is

Even though the code in void QOSGWidget::createContext() looks to me 
like it's almost identical to osgViewer::View::setUpViewInWindow() 
(except for the inheritedWindowData). Also, the resulting traits look 
sane to me. Why would it say the pixel format is invalid?

The message is emitted from 
osgViewer::GraphicsWindowWin32::setWindow(HWND), when the context is 
being created ( _hglrc = ::wglCreateContext(_hdc); ).

Has anyone run into this before? Any solutions?

Thanks in advance,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list