[osg-users] glew and graphics contexts

Robert Osfield robert.osfield at gmail.com
Thu Oct 18 11:14:28 PDT 2007


Hi Wills,

Since osgViewer by default will multi-thread the main thread calling
the realize() won't be the graphics thread so your glew call will
fail.

If you want to init glew then do it in a realize operation - see
osgshaderterrain for an example of this.

I have to ask way are you trying to use glew?  The OSG manages
extensions checking all itself and in a way that is thread safe and
robust w.r.t multiple graphics contexts.

Robert.

On 10/18/07, Wills Alan <AWILLS at qinetiq.com> wrote:
>
>
> If I have the following ...
>
> // ..create traits ...
> osg::GraphicsContext* gc =
> osg::GraphicsContext::createGraphicsContext(traits);
> gc->realize();
> gc->makeCurrent();
>
> GLenum err = glewInit();
>
> if (err != GL_OK)
>     // error msg.
> else
>     // ok
>
> ... then all is well.  But if I do ...
>
> osgViewer::Viewer viewer.
> viewer.setUpViewOnSingleScreen(0);
> viewer.realize();
>
>
> GLenum err = glewInit();
>
> if (err != GL_OK)
>     // error msg.
> else
>     // ok
>
> I get an error:  "Missing GL version"
>
> I'm checking the viewer's graphics context by doing
>
> std::vector<osg::GraphicsContext*> contexts;
> viewer->getContexts(contexts);
>
> with results:
> contexts.size() = 1;
> contexts[0]->isRealized() = 1;
> contexts[0]->isCurrent() = 1;
>
> but glewInit() returns an error.  What have I missed?
>
> Thanks,
> Alan.
>
>
> The information contained in this E-Mail and any subsequent
> correspondence is private and is intended solely for the intended
> recipient(s).  The information in this communication may be
> confidential and/or legally privileged.  Nothing in this e-mail is
> intended to conclude a contract on behalf of QinetiQ or make QinetiQ
> subject to any other legally binding commitments, unless the e-mail
> contains an express statement to the contrary or incorporates a formal
> Purchase Order.
>
> For those other than the recipient any disclosure, copying,
> distribution, or any action taken or omitted to be taken in reliance
> on such information is prohibited and may be unlawful.
>
> Emails and other electronic communication with QinetiQ may be
> monitored and recorded for business purposes including security, audit
> and archival purposes.  Any response to this email indicates consent
> to this.
>
> Telephone calls to QinetiQ may be monitored or recorded for quality
> control, security and other business purposes.
>
> QinetiQ Limited
> Registered in England & Wales: Company Number:3796233
> Registered office: 85 Buckingham Gate, London SW1E 6PD, United Kingdom
> Trading address: Cody Technology Park, Cody Building, Ively Road,
> Farnborough, Hampshire, GU14 0LX, United Kingdom
> http://www.QinetiQ.com/home/legal.html
> _______________________________________________
> 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