|
Public Types |
enum | Type { VERTEX = GL_VERTEX_SHADER,
FRAGMENT = GL_FRAGMENT_SHADER,
UNDEFINED = -1
} |
Public Member Functions |
| Shader (Type type=UNDEFINED) |
| Shader (Type type, const std::string &source) |
| Shader (const Shader &rhs, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY) |
| Copy constructor using CopyOp to manage deep vs shallow copy.
|
| META_Object (osg, Shader) |
int | compare (const Shader &rhs) const |
bool | setType (Type t) |
void | setShaderSource (const std::string &sourceText) |
| Load the Shader's source code text from a string.
|
bool | loadShaderSourceFromFile (const std::string &fileName) |
| Load the Shader's source code text from a file.
|
const std::string & | getShaderSource () const |
| Query the shader's source code text.
|
Type | getType () const |
| Get the Shader type as an enum.
|
const char * | getTypename () const |
| Get the Shader type as a descriptive string.
|
void | dirtyShader () |
| Mark our PCSs as needing recompilation.
|
void | compileShader (unsigned int contextID) const |
| If needed, compile the PCS's glShader.
|
void | attachShader (unsigned int contextID, GLuint program) const |
| For a given GL context, attach a glShader to a glProgram.
|
bool | getGlShaderInfoLog (unsigned int contextID, std::string &log) const |
| Query InfoLog from a glShader.
|
Static Public Member Functions |
Shader * | readShaderFile (Type type, const std::string &fileName) |
| Read shader source from file and then constructor shader of specified type.
|
void | deleteGlShader (unsigned int contextID, GLuint shader) |
| Mark internal glShader for deletion.
|
void | flushDeletedGlShaders (unsigned int contextID, double currentTime, double &availableTime) |
| flush all the cached glShaders which need to be deleted in the OpenGL context related to contextID.
|
Shader::Type | getTypeId (const std::string &tname) |
Protected Types |
typedef std::set< osg::Program * > | ProgramSet |
| osg::Programs that this osg::Shader is attached to
|
Protected Member Functions |
virtual | ~Shader () |
PerContextShader * | getPCS (unsigned int contextID) const |
bool | addProgramRef (osg::Program *program) |
bool | removeProgramRef (osg::Program *program) |
Protected Attributes |
Type | _type |
std::string | _shaderSource |
ProgramSet | _programSet |
osg::buffered_value< osg::ref_ptr<
PerContextShader > > | _pcsList |
It is a container to load the shader source code text and manage its compilation. An osg::Shader may be attached to more than one osg::Program. Shader will automatically manage per-context instancing of the internal objects, if that is necessary for a particular display configuration.