From Art Trevs, "File Changes:
- GL2Extensions, Program and Program.cpp Features: - Support for fragment output binding. (e.g. You can now specify in the fragment shader varying out vec3 fragOut; fragOut = vec3(1,0,1); to write to the fragOut variable. In your program you call glBindFragDataLocation(program, 1, "fragOut") to bind the fragOut variable with the MRT 1 - GL_COLOR_ATTACHMENT1_EXT) - new methods Program::add/removeBindFragDataLocation Program::getFragDataBindingList "
This commit is contained in:
@@ -267,6 +267,11 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
|
||||
bool getProgramInfoLog( GLuint program, std::string& result ) const;
|
||||
bool getShaderInfoLog( GLuint shader, std::string& result ) const;
|
||||
bool getAttribLocation( const char* attribName, GLuint& slot ) const;
|
||||
bool getFragDataLocation( const char* fragDataName, GLuint& slot) const;
|
||||
|
||||
//EXT_gpu_shader4 to support frag data binding
|
||||
void glBindFragDataLocation(GLuint program, GLuint colorNumber, const GLchar *name) const;
|
||||
GLint glGetFragDataLocation(GLuint program, const GLchar *name) const;
|
||||
|
||||
protected:
|
||||
~GL2Extensions() {}
|
||||
@@ -377,6 +382,9 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
|
||||
void* _glGetObjectParameterivARB;
|
||||
void* _glDeleteObjectARB;
|
||||
void* _glGetHandleARB;
|
||||
|
||||
void* _glBindFragDataLocation;
|
||||
void* _glGetFragDataLocation;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
|
||||
* Copyright (C) 2004-2005 Nathan Cournia
|
||||
*
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* 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.
|
||||
*
|
||||
@@ -94,12 +94,20 @@ class OSG_EXPORT Program : public osg::StateAttribute
|
||||
/** Add an attribute location binding. */
|
||||
void addBindAttribLocation( const std::string& name, GLuint index );
|
||||
|
||||
/** Add an attribute location binding. */
|
||||
/** Remove an attribute location binding. */
|
||||
void removeBindAttribLocation( const std::string& name );
|
||||
|
||||
/** Add an frag data location binding. See EXT_gpu_shader4 for BindFragDataLocationEXT */
|
||||
void addBindFragDataLocation( const std::string& name, GLuint index );
|
||||
|
||||
/** Remove an frag data location binding. */
|
||||
void removeBindFragDataLocation( const std::string& name );
|
||||
|
||||
typedef std::map<std::string,GLuint> AttribBindingList;
|
||||
typedef std::map<std::string,GLuint> FragDataBindingList;
|
||||
|
||||
const AttribBindingList& getAttribBindingList() const { return _attribBindingList; }
|
||||
const FragDataBindingList& getFragDataBindingList() const { return _fragDataBindingList; }
|
||||
|
||||
/** Return true if this Program represents "fixed-functionality" rendering */
|
||||
bool isFixedFunction() const;
|
||||
@@ -234,6 +242,7 @@ class OSG_EXPORT Program : public osg::StateAttribute
|
||||
|
||||
mutable osg::buffered_value< osg::ref_ptr<PerContextProgram> > _pcpList;
|
||||
AttribBindingList _attribBindingList;
|
||||
FragDataBindingList _fragDataBindingList;
|
||||
|
||||
typedef std::vector< ref_ptr<Shader> > ShaderList;
|
||||
ShaderList _shaderList;
|
||||
|
||||
Reference in New Issue
Block a user