From Mike Weiblen's osgGL2 node kit which support the latest OpenGL 2.0 extensions.
This commit is contained in:
47
include/osgGL2/Export
Normal file
47
include/osgGL2/Export
Normal file
@@ -0,0 +1,47 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGGL2_EXPORT_
|
||||
#define OSGGL2_EXPORT_ 1
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#pragma warning( disable : 4290 )
|
||||
#pragma warning( disable : 4305 )
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
|
||||
# ifdef OSGGL2_LIBRARY
|
||||
# define OSGGL2_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define OSGGL2_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define OSGGL2_EXPORT
|
||||
#endif
|
||||
|
||||
/* Define NULL pointer value */
|
||||
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* OSGGL2_EXPORT_ */
|
||||
|
||||
231
include/osgGL2/Extensions
Normal file
231
include/osgGL2/Extensions
Normal file
@@ -0,0 +1,231 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
* Copyright (C) 2003 3Dlabs Inc. Ltd.
|
||||
*
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* freely and without restriction, both in commericial and non commericial
|
||||
* applications, as long as this copyright notice is maintained.
|
||||
*
|
||||
* This application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* file: include/osgGL2/Extensions
|
||||
* author: Mike Weiblen 2003-07-14
|
||||
*
|
||||
* See http://www.3dlabs.com/opengl2/ for more information regarding
|
||||
* the OpenGL Shading Language.
|
||||
*/
|
||||
|
||||
#ifndef OSGGL2_EXTENSIONS
|
||||
#define OSGGL2_EXTENSIONS 1
|
||||
|
||||
#include <osg/Referenced>
|
||||
#include <osg/GL>
|
||||
#include <osgGL2/Export>
|
||||
|
||||
// If not defined by gl.h use the definitions found in the
|
||||
// arb_shader_objects, arb_vertex_shader, and arb_fragment_shader
|
||||
// specificiations.
|
||||
|
||||
#if !defined(GL_ARB_vertex_shader) && !defined(GL_ARB_fragment_shader) && !defined(GL_ARB_shader_objects) //(
|
||||
|
||||
typedef int GLhandleARB;
|
||||
typedef char GLcharARB;
|
||||
|
||||
#define GL_PROGRAM_OBJECT_ARB 0x8B40
|
||||
#define GL_OBJECT_TYPE_ARB 0x8B4E
|
||||
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
|
||||
|
||||
#define GL_SHADER_OBJECT_ARB 0x8B48
|
||||
#define GL_FLOAT_VEC2_ARB 0x8B50
|
||||
#define GL_FLOAT_VEC3_ARB 0x8B51
|
||||
#define GL_FLOAT_VEC4_ARB 0x8B52
|
||||
#define GL_INT_VEC2_ARB 0x8B53
|
||||
#define GL_INT_VEC3_ARB 0x8B54
|
||||
#define GL_INT_VEC4_ARB 0x8B55
|
||||
#define GL_BOOL_ARB 0x8B56
|
||||
#define GL_BOOL_VEC2_ARB 0x8B57
|
||||
#define GL_BOOL_VEC3_ARB 0x8B58
|
||||
#define GL_BOOL_VEC4_ARB 0x8B59
|
||||
#define GL_FLOAT_MAT2_ARB 0x8B5A
|
||||
#define GL_FLOAT_MAT3_ARB 0x8B5B
|
||||
#define GL_FLOAT_MAT4_ARB 0x8B5C
|
||||
|
||||
#define GL_VERTEX_SHADER_ARB 0x8B31
|
||||
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
|
||||
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
|
||||
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
|
||||
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
|
||||
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
|
||||
|
||||
#define GL_FRAGMENT_SHADER_ARB 0x8B30
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
|
||||
|
||||
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
|
||||
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
|
||||
|
||||
#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
|
||||
#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
|
||||
#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
|
||||
#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
|
||||
#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
|
||||
#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
|
||||
#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
|
||||
#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
|
||||
#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
|
||||
|
||||
#endif //)
|
||||
|
||||
|
||||
namespace osgGL2 {
|
||||
|
||||
/** 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 OSGGL2_EXPORT Extensions : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
Extensions();
|
||||
|
||||
Extensions(const Extensions& rhs);
|
||||
|
||||
void lowestCommonDenominator(const Extensions& rhs);
|
||||
|
||||
void setupGLExtensions();
|
||||
|
||||
void setShaderObjectsSupported(bool flag) { _isShaderObjectsSupported = flag; }
|
||||
bool isShaderObjectsSupported() const { return _isShaderObjectsSupported; }
|
||||
|
||||
void setVertexShaderSupported(bool flag) { _isVertexShaderSupported = flag; }
|
||||
bool isVertexShaderSupported() const { return _isVertexShaderSupported; }
|
||||
|
||||
void setFragmentShaderSupported(bool flag) { _isFragmentShaderSupported = flag; }
|
||||
bool isFragmentShaderSupported() const { return _isFragmentShaderSupported; }
|
||||
|
||||
/** Function to call to get the extension of a specified context.
|
||||
* If the Exentsion object for that context has not yet been created then
|
||||
* 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
|
||||
* only be created with the graphics context associated with ContextID..*/
|
||||
static Extensions* Get(unsigned int contextID,bool createIfNotInitalized);
|
||||
|
||||
/** 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 Set(unsigned int contextID,Extensions* extensions);
|
||||
|
||||
|
||||
|
||||
GLhandleARB glCreateShaderObject(GLenum shaderType) const;
|
||||
GLhandleARB glCreateProgramObject() const;
|
||||
void glDeleteObject(GLhandleARB obj) const;
|
||||
void glAttachObject(GLhandleARB containerObj, GLhandleARB obj) const;
|
||||
void glDetachObject(GLhandleARB containerObj, GLhandleARB attachedObj) const;
|
||||
void glShaderSource(GLhandleARB shaderObj, GLsizei count, const GLcharARB **strings, const GLint *length) const;
|
||||
void glCompileShader(GLhandleARB shaderObj) const;
|
||||
void glBindAttribLocation(GLhandleARB programObj, GLuint index, const GLcharARB *name) const;
|
||||
void glLinkProgram(GLhandleARB programObj) const;
|
||||
void glUseProgramObject(GLhandleARB programObj) const;
|
||||
void glGetInfoLog(GLhandleARB obj,GLsizei maxLength, GLsizei *length, GLcharARB *infoLog) const;
|
||||
void glGetAttachedObjects(GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj) const;
|
||||
void glGetShaderSource(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source) const;
|
||||
void glUniform1f(GLint location, GLfloat v0) const;
|
||||
void glUniform2f(GLint location, GLfloat v0, GLfloat v1) const;
|
||||
void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) const;
|
||||
void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) const;
|
||||
void glUniform1i(GLint location, GLint v0) const;
|
||||
void glUniform2i(GLint location, GLint v0, GLint v1) const;
|
||||
void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2) const;
|
||||
void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) const;
|
||||
void glUniform1fv(GLint location, GLsizei count, GLfloat *value) const;
|
||||
void glUniform2fv(GLint location, GLsizei count, GLfloat *value) const;
|
||||
void glUniform3fv(GLint location, GLsizei count, GLfloat *value) const;
|
||||
void glUniform4fv(GLint location, GLsizei count, GLfloat *value) const;
|
||||
void glUniform1iv(GLint location, GLsizei count, GLint *value) const;
|
||||
void glUniform2iv(GLint location, GLsizei count, GLint *value) const;
|
||||
void glUniform3iv(GLint location, GLsizei count, GLint *value) const;
|
||||
void glUniform4iv(GLint location, GLsizei count, GLint *value) const;
|
||||
void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value) const;
|
||||
void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value) const;
|
||||
void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, GLfloat *value) const;
|
||||
GLint glGetUniformLocation(GLhandleARB programObject, const GLcharARB *name) const;
|
||||
GLint glGetAttribLocation(GLhandleARB programObj, const GLcharARB *name) const;
|
||||
void glGetActiveUniform(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLint *type, GLcharARB *name) const;
|
||||
void glGetActiveAttribs(GLhandleARB programObj, GLint *count, const GLint **size, const GLenum **type, const GLcharARB* const **attributes) const;
|
||||
void glGetUniformfv(GLhandleARB programObj, GLint location, GLfloat *params) const;
|
||||
void glGetUniformiv(GLhandleARB programObj, GLint location, GLint *params) const;
|
||||
void glGetObjectParameterfv(GLhandleARB obj, GLenum pname, GLfloat *params) const;
|
||||
void glGetObjectParameteriv(GLhandleARB obj, GLenum pname, GLint *params) const;
|
||||
GLhandleARB glGetHandle(GLenum pname) const;
|
||||
|
||||
protected:
|
||||
|
||||
~Extensions() {}
|
||||
|
||||
bool _isShaderObjectsSupported;
|
||||
bool _isVertexShaderSupported;
|
||||
bool _isFragmentShaderSupported;
|
||||
|
||||
void* _glCreateShaderObject;
|
||||
void* _glCreateProgramObject;
|
||||
void* _glDeleteObject;
|
||||
void* _glAttachObject;
|
||||
void* _glDetachObject;
|
||||
void* _glShaderSource;
|
||||
void* _glCompileShader;
|
||||
void* _glBindAttribLocation;
|
||||
void* _glLinkProgram;
|
||||
void* _glUseProgramObject;
|
||||
void* _glGetInfoLog;
|
||||
void* _glGetAttachedObjects;
|
||||
void* _glGetShaderSource;
|
||||
void* _glUniform1f;
|
||||
void* _glUniform2f;
|
||||
void* _glUniform3f;
|
||||
void* _glUniform4f;
|
||||
void* _glUniform1i;
|
||||
void* _glUniform2i;
|
||||
void* _glUniform3i;
|
||||
void* _glUniform4i;
|
||||
void* _glUniform1fv;
|
||||
void* _glUniform2fv;
|
||||
void* _glUniform3fv;
|
||||
void* _glUniform4fv;
|
||||
void* _glUniform1iv;
|
||||
void* _glUniform2iv;
|
||||
void* _glUniform3iv;
|
||||
void* _glUniform4iv;
|
||||
void* _glUniformMatrix2fv;
|
||||
void* _glUniformMatrix3fv;
|
||||
void* _glUniformMatrix4fv;
|
||||
void* _glGetUniformLocation;
|
||||
void* _glGetAttribLocation;
|
||||
void* _glGetActiveUniform;
|
||||
void* _glGetActiveAttribs;
|
||||
void* _glGetUniformfv;
|
||||
void* _glGetUniformiv;
|
||||
void* _glGetObjectParameterfv;
|
||||
void* _glGetObjectParameteriv;
|
||||
void* _glGetHandle;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
214
include/osgGL2/ProgramObject
Normal file
214
include/osgGL2/ProgramObject
Normal file
@@ -0,0 +1,214 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
* Copyright (C) 2003 3Dlabs Inc. Ltd.
|
||||
*
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* freely and without restriction, both in commericial and non commericial
|
||||
* applications, as long as this copyright notice is maintained.
|
||||
*
|
||||
* This application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* file: include/osgGL2/ProgramObject
|
||||
* author: Mike Weiblen 2003-07-14
|
||||
*
|
||||
* See http://www.3dlabs.com/opengl2/ for more information regarding
|
||||
* the OpenGL Shading Language.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OSGGL2_PROGRAMOBJECT
|
||||
#define OSGGL2_PROGRAMOBJECT 1
|
||||
|
||||
#include <osg/State>
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/buffered_value>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <osgGL2/Export>
|
||||
#include <osgGL2/Extensions>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
// TODO This type enum must be officially added to osg::StateAttribute::Types
|
||||
#define PROGRAMOBJECT (osg::StateAttribute::VERTEXPROGRAM + 1)
|
||||
|
||||
namespace osgGL2 {
|
||||
|
||||
/** use deleteObject instead of glDeleteObject to allow
|
||||
* GL2 Objects to cached until they can be deleted
|
||||
* by the OpenGL context in which they were created, specified
|
||||
* by contextID.*/
|
||||
void DeleteObject(unsigned int contextID, GLhandleARB handle);
|
||||
|
||||
/** flush all the cached glProgramObjects which need to be deleted
|
||||
* in the OpenGL context related to contextID.*/
|
||||
void FlushDeletedGL2Objects(unsigned int contextID);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ShaderObject;
|
||||
|
||||
/** Encapsulates the OpenGL Shading Language ProgramObject */
|
||||
class OSGGL2_EXPORT ProgramObject : public osg::StateAttribute
|
||||
{
|
||||
public:
|
||||
|
||||
ProgramObject();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
ProgramObject(const ProgramObject& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_StateAttribute(osgGL2, ProgramObject, PROGRAMOBJECT);
|
||||
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const osg::StateAttribute& sa) const
|
||||
{
|
||||
// check the types are equal and then create the rhs variable
|
||||
// used by the COMPARE_StateAttribute_Paramter macro's below.
|
||||
COMPARE_StateAttribute_Types(ProgramObject,sa)
|
||||
|
||||
// compare each parameter in turn against the rhs.
|
||||
COMPARE_StateAttribute_Parameter(_shaderObjectList);
|
||||
// COMPARE_StateAttribute_Parameter(_pcpoList);
|
||||
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& ) const {}
|
||||
|
||||
virtual void apply(osg::State& state) const;
|
||||
|
||||
virtual void compile(osg::State& state) const { apply(state); }
|
||||
|
||||
// data access methods.
|
||||
|
||||
/** Force a relink on next apply() of associated glProgramObject. */
|
||||
void dirtyProgramObject();
|
||||
|
||||
void addShader( ShaderObject* shader );
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ProgramObject();
|
||||
|
||||
typedef std::vector< osg::ref_ptr<ShaderObject> > ShaderObjectList;
|
||||
ShaderObjectList _shaderObjectList;
|
||||
|
||||
|
||||
class OSGGL2_EXPORT PerContextProgObj : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
PerContextProgObj(const ProgramObject* parent, Extensions* extensions);
|
||||
PerContextProgObj(const PerContextProgObj& rhs);
|
||||
|
||||
GLhandleARB& getHandle() {return _handle;}
|
||||
|
||||
bool isDirty() const {return _dirty;}
|
||||
void markAsDirty() {_dirty = true; }
|
||||
void markAsClean() {_dirty = false;}
|
||||
bool build() const;
|
||||
void use() const;
|
||||
|
||||
void markAsAttached() {_unattached = false;}
|
||||
bool isUnattached() const {return _unattached;}
|
||||
|
||||
protected:
|
||||
PerContextProgObj() {};
|
||||
~PerContextProgObj();
|
||||
|
||||
const ProgramObject* _parent;
|
||||
osg::ref_ptr<Extensions> _extensions;
|
||||
GLhandleARB _handle;
|
||||
bool _dirty;
|
||||
bool _unattached;
|
||||
};
|
||||
|
||||
typedef osg::buffered_value< osg::ref_ptr<PerContextProgObj> > PCPOList;
|
||||
mutable PCPOList _pcpoList;
|
||||
|
||||
PerContextProgObj* getPCPO(unsigned int contextID) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** Encapsulates the OpenGL Shading Language ShaderObject */
|
||||
class OSGGL2_EXPORT ShaderObject : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type {
|
||||
VERTEX = GL_VERTEX_SHADER_ARB,
|
||||
FRAGMENT = GL_FRAGMENT_SHADER_ARB,
|
||||
UNKNOWN = -1
|
||||
};
|
||||
|
||||
ShaderObject();
|
||||
ShaderObject(Type type);
|
||||
ShaderObject(Type type, const char* sourceText);
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
ShaderObject(const ShaderObject& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
META_Object(osgGL2, ShaderObject);
|
||||
|
||||
// data access methods.
|
||||
|
||||
void setShaderSource( const char* sourceText );
|
||||
inline const std::string& getShaderSource() const {return _shaderSource; }
|
||||
bool loadShaderSourceFromFile( const char* fileName );
|
||||
Type getType() const { return _type; }
|
||||
|
||||
/** Force a recompile on next apply() of associated glShaderObject. */
|
||||
void dirtyShaderObject();
|
||||
|
||||
bool build(unsigned int contextID) const;
|
||||
void attach(unsigned int contextID, GLhandleARB progObj) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ShaderObject();
|
||||
|
||||
std::string _shaderSource;
|
||||
Type _type;
|
||||
|
||||
class OSGGL2_EXPORT PerContextShaderObj : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
PerContextShaderObj(const ShaderObject* parent, Extensions* extensions);
|
||||
PerContextShaderObj(const PerContextShaderObj& rhs);
|
||||
|
||||
GLhandleARB& getHandle() {return _handle;}
|
||||
|
||||
bool isDirty() const {return _dirty;}
|
||||
void markAsDirty() {_dirty = true; }
|
||||
void markAsClean() {_dirty = false;}
|
||||
bool build();
|
||||
|
||||
void attach(GLhandleARB progObj);
|
||||
|
||||
protected:
|
||||
PerContextShaderObj() {};
|
||||
~PerContextShaderObj();
|
||||
|
||||
const ShaderObject* _parent;
|
||||
osg::ref_ptr<Extensions> _extensions;
|
||||
GLhandleARB _handle;
|
||||
bool _dirty;
|
||||
};
|
||||
|
||||
typedef osg::buffered_value< osg::ref_ptr<PerContextShaderObj> > PCSOList;
|
||||
mutable PCSOList _pcsoList;
|
||||
|
||||
PerContextShaderObj* getPCSO(unsigned int contextID) const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
49
include/osgGL2/Version
Normal file
49
include/osgGL2/Version
Normal file
@@ -0,0 +1,49 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGGL2_VERSION
|
||||
#define OSGGL2_VERSION 1
|
||||
|
||||
#include <osgGL2/Export>
|
||||
|
||||
extern "C" {
|
||||
|
||||
/*
|
||||
* osgGL2GetVersion() returns the library version number.
|
||||
* Numbering convention : OpenSceneGraph-GL2-0.1 will return 0.1 from osgGL2getVersion.
|
||||
*
|
||||
* This C function can be also used to check for the existence of the OpenSceneGraph
|
||||
* library using autoconf and its m4 macro AC_CHECK_LIB.
|
||||
*
|
||||
* Here is the code to add to your configure.in:
|
||||
\verbatim
|
||||
#
|
||||
# Check for the OpenSceneGraph-GL2 library
|
||||
#
|
||||
AC_CHECK_LIB(osg, osgGL2GetVersion, ,
|
||||
[AC_MSG_ERROR(OpenSceneGraph library not found. See http://www.openscenegraph.org)],)
|
||||
\endverbatim
|
||||
*/
|
||||
|
||||
extern OSGGL2_EXPORT const char* osgGL2GetVersion();
|
||||
|
||||
/*
|
||||
* osgGL2GetLibraryName() returns the library name in human friendly form.
|
||||
*/
|
||||
|
||||
extern OSGGL2_EXPORT const char* osgGL2GetLibraryName();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user