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

Jeremy Moles jeremy at emperorlinux.com
Mon Sep 8 11:48:18 PDT 2008

On Mon, 2008-09-08 at 14:43 -0400, Jean-Sébastien Guay wrote:
> Hi all,
> We'll probably be using Qt for our next GUI project with OSG, and so I 
> started looking into the osgviewerQT example.

Qt as the application's "encompassing" GUI or are you going to use Qt
somehow to also create GUI widgets in your GL scene? I've seen a lot of
traffic about this lately and have begun to wonder if I'm
misunderstanding. :)

> 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
>    invalid.
> 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,
> J-S

More information about the osg-users mailing list