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

Robert Osfield robert.osfield at gmail.com
Tue Sep 9 02:20:04 PDT 2008

Hi J-S,

I'm no QT or Windows expert so I'll just have to guess at what might
be up.  The pixel format error sounds a bit like what was an issue in
the early days of osgviewerMFC - in that the pixel format of the
underlying window has to be created specifically to support the pixel
format that the graphics context is created with.  I don't recall the
exact details but perhaps this hint can set you off in the right

On side note, one of the things I'd like to see for the osgViewer
library is for us to migrate standard GraphicsWindow implementations
for the major GUI toolkits from the examples into
include/osgViewer/api/.  If we can keep these implementations purely
done in the header then we won't need to compile the osgViewer library
itself against them, and just have them there in case users want to
use that Windowing toolkit.   The implementations will need to be a
fully thread capable, so not use the GraphicsWindowEmbedded feature.


On Mon, Sep 8, 2008 at 7:43 PM, Jean-Sébastien Guay
<jean-sebastien.guay at cm-labs.com> 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.
> 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
> --
> ______________________________________________________
> Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list