Moved local Extensions structs into GL2Extensions

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14584 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-12-09 14:57:25 +00:00
parent 3f1e77d479
commit e31f682451
15 changed files with 110 additions and 518 deletions

View File

@@ -80,49 +80,7 @@ class OSG_EXPORT ClampColor : public StateAttribute
void setClampReadColor(GLenum mode) { _clampReadColor = mode; }
GLenum getClampReadColor() const { return _clampReadColor; }
virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension
* function pointers, and provides convenience wrappers for
* calling extension functions. */
class OSG_EXPORT Extensions : public osg::Referenced
{
public:
Extensions(unsigned int contextID);
Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID);
void setClampColorSupported(bool flag) { _isClampColorSupported=flag; }
bool isClampColorSupported() const { return _isClampColorSupported; }
void glClampColor(GLenum target, GLenum mode) const;
protected:
~Extensions() {}
typedef void (GL_APIENTRY * GLClampColorProc) (GLenum target, GLenum mode);
bool _isClampColorSupported;
GLClampColorProc _glClampColor;
};
/** Returns the Extensions object for the given context.
* If createIfNotInitalized is true and the Extensions object doesn't
* exist, getExtensions() creates it on the given context.
* Returns NULL if createIfNotInitalized is false and the Extensions
* object doesn't exist. */
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
/** setExtensions() allows users to override the extensions across graphics contexts.
* Typically used when you have different extensions supported across graphics pipes,
* but need to ensure that they all use the same low common denominator extensions. */
static void setExtensions(unsigned int contextID,Extensions* extensions);
protected :

View File

@@ -60,14 +60,6 @@ class OSG_EXPORT ColorMaski : public ColorMask
virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension function pointers. */
struct OSG_EXPORT Extensions : public osg::Referenced
{
Extensions(unsigned int contextID);
void (GL_APIENTRY * glColorMaski)(GLuint buf, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
};
protected:
virtual ~ColorMaski();

View File

@@ -941,6 +941,34 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
void (GL_APIENTRY * glStencilFuncSeparateATI) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
// ColorMask
void (GL_APIENTRY * glColorMaski)(GLuint buf, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
// ClampColor
bool isClampColorSupported;
void (GL_APIENTRY * glClampColor) (GLenum target, GLenum mode);
// PrimitiveRestartIndex
void (GL_APIENTRY * glPrimitiveRestartIndex) ( GLuint index );
// Mutlisample
bool isMultisampleSupported;
bool isMultisampleFilterHintSupported;
void (GL_APIENTRY * glSampleCoverage) (GLclampf value, GLboolean invert);
// Point
bool isPointParametersSupported;
bool isPointSpriteSupported;
bool isPointSpriteCoordOriginSupported;
void (GL_APIENTRY * glPointParameteri) (GLenum pname, GLint param);
void (GL_APIENTRY * glPointParameterf) (GLenum pname, GLfloat param);
void (GL_APIENTRY * glPointParameterfv) (GLenum pname, const GLfloat *params);
};
}

View File

@@ -92,55 +92,6 @@ class OSG_EXPORT Multisample : public StateAttribute
virtual void apply(State& state) const;
/** Extensions class which encapsulates the querying of extensions and
* associated function pointers, and provide convenience wrappers to
* check for the extensions or use the associated functions.*/
class OSG_EXPORT Extensions : public osg::Referenced
{
public:
Extensions(unsigned int contextID);
Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID);
void setMultisampleSupported(bool flag) { _isMultisampleSupported=flag; }
void setMultisampleFilterHintSupported(bool flag) { _isMultisampleFilterHintSupported=flag; }
bool isMultisampleSupported() const { return _isMultisampleSupported; }
bool isMultisampleFilterHintSupported() const { return _isMultisampleFilterHintSupported; }
void glSampleCoverage(GLclampf value, GLboolean invert) const;
protected:
~Extensions() {}
bool _isMultisampleSupported;
bool _isMultisampleFilterHintSupported;
typedef void (GL_APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert);
GLSampleCoverageProc _glSampleCoverage;
};
/** Function to call to get the extension of a specified context.
* If the Extension object for that context has not yet been created
* and the 'createIfNotInitalized' flag been set to false then returns NULL.
* If 'createIfNotInitalized' is true then the Extensions object is
* automatically created. However, in this case the extension object will
* only be created with the graphics context associated with ContextID..*/
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
/** setExtensions allows users to override the extensions across graphics contexts.
* Typically used when you have different extensions supported across graphics pipes
* but need to ensure that they all use the same low common denominator extensions.*/
static void setExtensions(unsigned int contextID,Extensions* extensions);
protected :
virtual ~Multisample();

View File

@@ -87,59 +87,6 @@ class OSG_EXPORT Point : public StateAttribute
virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension
* function pointers, and provides convenience wrappers for
* calling extension functions. */
class OSG_EXPORT Extensions : public osg::Referenced
{
public:
Extensions(unsigned int contextID);
Extensions(const Extensions& rhs);
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtensions(unsigned int contextID);
void setPointParametersSupported(bool flag) { _isPointParametersSupported=flag; }
bool isPointParametersSupported() const { return _isPointParametersSupported; }
void setPointSpriteCoordOriginSupported(bool flag) { _isPointSpriteCoordOriginSupported=flag; }
bool isPointSpriteCoordOriginSupported() const { return _isPointSpriteCoordOriginSupported; }
void glPointParameteri(GLenum pname, GLint param) const;
void glPointParameterf(GLenum pname, GLfloat param) const;
void glPointParameterfv(GLenum pname, const GLfloat *params) const;
protected:
~Extensions() {}
bool _isPointParametersSupported;
bool _isPointSpriteCoordOriginSupported;
typedef void (GL_APIENTRY * GLPointParameteriProc) (GLenum pname, GLint param);
typedef void (GL_APIENTRY * GLPointParameterfProc) (GLenum pname, GLfloat param);
typedef void (GL_APIENTRY * GLPointParameterfvProc) (GLenum pname, const GLfloat *params);
GLPointParameteriProc _glPointParameteri;
GLPointParameterfProc _glPointParameterf;
GLPointParameterfvProc _glPointParameterfv;
};
/** Returns the Extensions object for the given context.
* If createIfNotInitalized is true and the Extensions object doesn't
* exist, getExtensions() creates it on the given context.
* Returns NULL if createIfNotInitalized is false and the Extensions
* object doesn't exist. */
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
/** setExtensions() allows users to override the extensions across graphics contexts.
* Typically used when you have different extensions supported across graphics pipes,
* but need to ensure that they all use the same low common denominator extensions. */
static void setExtensions(unsigned int contextID,Extensions* extensions);
protected :
virtual ~Point();

View File

@@ -59,8 +59,6 @@ public:
virtual void apply(osg::State& state) const;
static bool isPointSpriteSupported(unsigned int context);
enum CoordOriginMode {
UPPER_LEFT = GL_UPPER_LEFT,
LOWER_LEFT = GL_LOWER_LEFT

View File

@@ -18,7 +18,7 @@
namespace osg {
/**
/**
* osg::PrimitiveRestartIndex does nothing if OpenGL 3.1 is not available.
*/
class OSG_EXPORT PrimitiveRestartIndex : public StateAttribute
@@ -35,13 +35,14 @@ class OSG_EXPORT PrimitiveRestartIndex : public StateAttribute
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const;
inline void setRestartIndex(unsigned int restartIndex ) { _restartIndex = restartIndex; }
inline unsigned int getRestartIndex() const { return _restartIndex; }
virtual void apply(State& state) const;
#if 0
public:
/** Extensions class which encapsulates the querying of extensions and
@@ -67,19 +68,19 @@ class OSG_EXPORT PrimitiveRestartIndex : public StateAttribute
protected:
~Extensions() {}
bool _isOpenGL31Supported;
bool _isPrimitiveRestartIndexNVSupported;
typedef void (GL_APIENTRY * PrimitiveRestartIndex)( GLuint index );
PrimitiveRestartIndex _glPrimitiveRestartIndex;
};
static Extensions* getExtensions(unsigned int contextID,bool createIfNotInitalized);
static void setExtensions(unsigned int contextID,Extensions* extensions);
#endif
protected:

View File

@@ -31,9 +31,7 @@ namespace osg {
* GL_EXT_stencil_wrap extension is present.
*
* If INCR_WRAP or DECR_WRAP values are used while they are detected to be not supported,
* the INCR or DECR values are sent to OpenGL instead. Note: do not use Stencil::getFunction()
* to detect whether WRAP operations is used as the object's value is kept intact.
* Use osg::Stencil::getExtensions() method instead.
* the INCR or DECR values are sent to OpenGL instead.
*
* OpenGL 2.0 introduced two side stenciling that is available through
* osg::StencilTwoSided class.