[osg-users] Specifying the GL context version to request
Sandro Mani
manisandro at gmail.com
Mon Aug 21 06:36:03 PDT 2017
On 21.08.2017 14:59, Robert Osfield wrote:
> Hi Sandro,
>
> On 21 August 2017 at 13:21, Sandro Mani <manisandro at gmail.com
> <mailto:manisandro at gmail.com>> wrote:
>
> A less invasive alternative could be to introduce a new singleton
> called OpenGLSettings or similar which contains just the three
> settings glContextVersion, glContextFlags, glContextProfileMask.
>
>
> I don't see how this is different, if you are setting setting a
> default that users might not realize is now being set differently,
> it's just the same issue expressed in a slightly different way.
Mh yeah my quick reaction was just that as opposed to other fields in
the DisplaySettings, the desired OpenGL context version is likely to be
a constant thoughout the lifetime of the application.
>
> --
>
> Currently when the osgViewer::Viewer is constructed and run() is
> called without the viewer explictly setting up the graphics context
> it's fallback to using the setUpViewAcrossAllScreens() and within this
> implementation when it sets up the Traits it passes the DisplaySetting
> assigned to the Viewer or DisplaySetting::instance() will be used if
> none is assigned. This fallback is functionally the same as you are
> after and this already will be working.
>
> For places where the windows are being explicitly set up then they
> will be creating a Traits themselves and at this point I'm happy for
> them to need to explicitly specify the settings or pass in the
> DisplaySettings they want to use as defaults.
Admittedly, I'm not very familiar with OpenSceneGraph, my main
motivation digging into this is just to get osgEarth working again under
Linux, as it has been broken for the past couple of years ever since it
started requiring GLSL330+.
That said, I found it confusing and it took me some time to figure out
how to actually set the glContextVersion etc. The DisplaySettings had no
effect, and only after digging into the code I realized that it was
because osgEarth creates its version without specifying a
DisplaySettings instance [1]. After becoming more familiar with the
internal workings, I suppose this can be classified as a bug in
osgEarth, but I feel that a user new to OSG could expect that the
settings specified in the global DisplaySettings singleton actually have
an effect on the Traits if it is constructed without a specific ds
instance passed.
Just my thoughts.
Sandro
[1]
https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/Capabilities.cpp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170821/14fc9747/attachment.htm>
More information about the osg-users
mailing list