Added glContexVersion, glContextFlags and glContextProfileMask members to osg::GraphicsContext::Traits to support GL3 graphics context creation.
Moved the handling of DisplaySettings into Traits constructor. Added support for s/getGLContextVersion(), s/getGLContextFlags() and s/getGLContextProfileMask() to osg::DisplaySettings. Added command line and env var support for setting the GLContextVersion, GLContextFlags and GLContextProfileMask to osg::DisplaySettings.
This commit is contained in:
@@ -206,6 +206,24 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
|
||||
void setMaxBufferObjectPoolSize(unsigned int size) { _maxBufferObjectPoolSize = size; }
|
||||
unsigned int getMaxBufferObjectPoolSize() const { return _maxBufferObjectPoolSize; }
|
||||
|
||||
/** Set the hint of which OpenGL version to attempt to create a graphics context for.*/
|
||||
void setGLContextVersion(const std::string& version) { _glContextVersion = version; }
|
||||
|
||||
/** Get the hint of which OpenGL version to attempt to create a graphics context for.*/
|
||||
const std::string getGLContextVersion() const { return _glContextVersion; }
|
||||
|
||||
/** Set the hint of the flags to use in when creating graphic contexts.*/
|
||||
void setGLContextFlags(unsigned int flags) { _glContextFlags = flags; }
|
||||
|
||||
/** Get the hint of the flags to use in when creating graphic contexts.*/
|
||||
unsigned int getGLContextFlags() const { return _glContextFlags; }
|
||||
|
||||
/** Set the hint of the profile mask to use in when creating graphic contexts.*/
|
||||
void setGLContextProfileMask(unsigned int mask) { _glContextProfileMask = mask; }
|
||||
|
||||
/** Get the hint of the profile mask to use in when creating graphic contexts.*/
|
||||
unsigned int getGLContextProfileMask() const { return _glContextProfileMask; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~DisplaySettings();
|
||||
@@ -249,6 +267,10 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
|
||||
|
||||
unsigned int _maxTexturePoolSize;
|
||||
unsigned int _maxBufferObjectPoolSize;
|
||||
|
||||
std::string _glContextVersion;
|
||||
unsigned int _glContextFlags;
|
||||
unsigned int _glContextProfileMask;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -68,35 +68,7 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
/** GraphicsContext Traits object provides the specification of what type of graphics context is required.*/
|
||||
struct Traits : public osg::Referenced, public ScreenIdentifier
|
||||
{
|
||||
Traits():
|
||||
x(0),
|
||||
y(0),
|
||||
width(0),
|
||||
height(0),
|
||||
windowDecoration(false),
|
||||
supportsResize(true),
|
||||
red(8),
|
||||
blue(8),
|
||||
green(8),
|
||||
alpha(0),
|
||||
depth(24),
|
||||
stencil(0),
|
||||
sampleBuffers(0),
|
||||
samples(0),
|
||||
pbuffer(false),
|
||||
quadBufferStereo(false),
|
||||
doubleBuffer(false),
|
||||
target(0),
|
||||
format(0),
|
||||
level(0),
|
||||
face(0),
|
||||
mipMapGeneration(false),
|
||||
vsync(true),
|
||||
useMultiThreadedOpenGLEngine(false),
|
||||
useCursor(true),
|
||||
sharedContext(0),
|
||||
setInheritedWindowPixelFormat(false),
|
||||
overrideRedirect(false) {}
|
||||
Traits(DisplaySettings* ds=0);
|
||||
|
||||
// graphics context original and size
|
||||
int x;
|
||||
@@ -141,6 +113,12 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
|
||||
// enable cursor
|
||||
bool useCursor;
|
||||
|
||||
// settings used in set up of graphics context, only presently used by GL3 build of OSG.
|
||||
std::string glContextVersion;
|
||||
unsigned int glContextFlags;
|
||||
unsigned int glContextProfileMask;
|
||||
|
||||
|
||||
// shared context
|
||||
GraphicsContext* sharedContext;
|
||||
|
||||
Reference in New Issue
Block a user