#include
<oglplus/program.hpp>
template <> class ObjCommonOps<tag::Program> : public ProgramName { public: static ProgramName Binding(void); static void Bind(ProgramName program); void Bind(void) const; void Use(void); };
Returns the currently bound program. See |
|
Binds the specified |
|
Binds |
|
Makes |
template <> class ObjectOps<tag::DirectState, tag::Program> : public ObjZeroOps<tag::DirectState, tag::Program> { public: ObjectOps& AttachShader(ShaderName shader); ObjectOps& AttachShaders(const Sequence<ShaderName>& shaders); ObjectOps& DetachShader(ShaderName shader); Boolean IsLinked(void) const; String GetInfoLog(void) const; ObjectOps& Link(void); Outcome<ObjectOps&> Link(std::nothrow_t); Outcome<ObjectOps&> Build(void); #if GL_ARB_shading_language_include Outcome<ObjectOps&> BuildInclude( SizeType count, const GLchar* const* paths, const GLint* lengths ); Outcome<ObjectOps&> BuildInclude(GLSLString&& incl); Outcome<ObjectOps&> BuildInclude(GLSLStrings&& incl); Outcome<ObjectOps&> BuildInclude(const GLSLSource&& incl); #endif Boolean IsValid(void) const; ObjectOps& Validate(void); Outcome<ObjectOps&> Validate(std::nothrow_t);
Attaches a shader to |
|
Attaches a set of shaders to |
|
Detaches a shader from |
|
Returns true if |
|
Returns the linker output if the program is linked. See |
|
Links this shading language program. Throws LinkError
if the program cannot be linked. See |
|
Checks if all attached shaders are compiled and if they are not the
it compiles them and then links this Program.
Throws CompileError
if any of the shaders cannot be compiled, throws LinkError
if the program cannot be linked. See |
|
Checks if all attached shaders are compiled and if they are not the
it compiles them and using the specified include paths and then links
|
|
Returns true if |
|
Validates |
void TransformFeedbackVarying(const GLchar* varying); void TransformFeedbackVaryings( SizeType count, const GLchar** varyings, TransformFeedbackMode mode ); template <typename std::size_t N> void TransformFeedbackVaryings( const GLchar* (&varyings)[N], TransformFeedbackMode mode ); void TransformFeedbackVaryings( const std::vector<String>& varyings, TransformFeedbackMode mode ) const; #if GL_VERSION_4_1 || GL_ARB_separate_shader_objects ObjectOps& MakeSeparable(Boolean para = true); #endif #if GL_VERSION_4_1 || GL_ARB_get_program_binary ObjectOps& MakeRetrievable(Boolean para = true); void GetBinary(std::vector<GLubyte>& binary, GLenum& format) const; void Binary(const std::vector<GLubyte>& binary, GLenum format); #endif typedef <Unspecified> InterfaceContext; #if GL_VERSION_4_3 typedef Range<ProgramResource> ActiveResourceRange; InterfaceContext ActiveResourceContext(ProgramInterface intf) const; ActiveResourceRange ActiveResources(ProgramInterface intf) const; #endif
Sets the variables that will be captured during transform feedback
See |
|
Sets the variables that will be captured during transform feedback
See |
|
Makes this program separable (or non-separable). See |
|
Makes this program retrievable (or non-retrievable) in binary form.
See |
|
Gets the program code in binary form. See |
|
Specifies the program code in binary form. See |
|
Helper class for efficient iteration of |
|
The type of the range for traversing program resource information. |
|
Returns the context for traversal of Program's active resources. |
|
Returns a range allowing to do the traversal of interface's resources.
This instance of |
class ActiveVariableInfo { public: GLuint Index(void) const; const String& Name(void) const; const GLint Size(void) const; const SLDataType Type(void) const; }; typedef Range<ActiveVariableInfo> ActiveAttribRange; InterfaceContext ActiveAttribContext(void) const; ActiveAttribRange ActiveAttribs(void) const; typedef Range<ActiveVariableInfo> ActiveUniformRange; InterfaceContext ActiveUniformContext(void) const; ActiveUniformRange ActiveUniforms(void) const;
Class providing information about a single active vertex attribute
or uniform. Note that the |
|
Returns the index of the attribute or uniform. |
|
Returns the name (identifier) of the attribute or uniform. |
|
Returns the size in units of |
|
Returns the data type of the variable. |
|
The type of the range for traversing active vertex attributes. |
|
Returns the context for traversal of |
|
Returns a range allowing to do the traversal of active attributes.
This instance of |
|
The type of the range for traversing active uniforms. |
|
Returns the context for traversal of Program's active uniforms. |
|
Returns a range allowing to do the traversal of active uniforms. This
instance of |
#if GL_VERSION_4_0 || GL_ARB_shader_subroutine typedef Range<ActiveVariableInfo> ActiveSubroutineRange; InterfaceContext ActiveSubroutineContext(ShaderType stage) const; ActiveSubroutineRange ActiveSubroutines(ShaderType stage) const; typedef Range<ActiveVariableInfo> ActiveSubroutineUniformRange; InterfaceContext ActiveSubroutineUniformContext(ShaderType stage) const; ActiveSubroutineUniformRange ActiveSubroutineUniforms(ShaderType stage) const; #endif typedef Range<ActiveVariableInfo> TransformFeedbackVaryingRange; InterfaceContext TransformFeedbackVaryingContext(void) const; TransformFeedbackVaryingRange TransformFeedbackVaryings(void) const; ShaderRange AttachedShaders(void) const;
The type of the range for traversing active subroutines. |
|
Returns the context for traversal of Program's active subroutines. |
|
Returns a range allowing to do the traversal of subroutines. This instance
of |
|
The type of the range for traversing active subroutine uniforms. |
|
Returns the context for traversal of Program's active subroutine uniforms. |
|
Returns a range allowing to do the traversal of subroutine uniforms.
This instance of |
|
The type of the range for traversing transform feedback varyings. |
|
Returns the context for traversal of Program's active transform feedback varyings. |
|
Returns a range allowing to do the traversal of transform feedback
varyings. This instance of |
|
Returns a range allowing to traverse shaders attached to |
TransformFeedbackMode TransformFeedbackBufferMode(void) const; #if GL_VERSION_3_2 GLint GeometryVerticesOut(void) const; PrimitiveType GeometryInputType(void) const; PrimitiveType GeometryOutputType(void) const; #endif #if GL_VERSION_4_1 || GL_ARB_gpu_shader5 GLint GeometryShaderInvocations(void) const; #endif #if GL_VERSION_4_0 || GL_ARB_tessellation_shader FaceOrientation TessGenVertexOrder(void) const; TessGenPrimitiveType TessGenMode(void) const; TessGenPrimitiveSpacing TessGenSpacing(void) const; Boolean TessGenPointMode(void) const; #endif void BindLocation( VertexAttribSlot vertex_attrib_slot, StrCRef identifier ); };
Returns the transform feedback buffer mode. See |
|
Returns the number of vertices that the geometry shader will output.
See |
|
Returns the geometry shader input primitive type See |
|
Returns the geometry shader output primitive type See |
|
Returns the number of invocations of geometry shader per primitive.
See |
|
Returns the vertex order in tesselation evaluation shader. See |
|
Returns the tesselation generator output primitive type. See |
|
Returns the tesselation generator primitive spacing mode. See |
|
Returns true if point mode is enabled in tesslation eval. shader. See
|
|
Binds the location of a shading language variable to a vertex attribute. |
typedef ObjectOps<tag::DirectState, tag::Program> ProgramOps; typedef ObjectZero<ObjZeroOps<tag::DirectState, tag::Program>> NoProgram; typedef Object<ProgramOps> Program;
The following code snippet shows the basic setup of a Program.
Context gl; VertexShader vxs; vxs.Source( "#version 150\n" "in vec3 Position;\n" "void main(void)\n" "{\n" " gl_Position = Position;\n" "}\n" ).Compile(); TessControlShader tcs; tcs.Source(/* ... */).Compile(); TessEvaluationShader tes; tes.Source(/* ... */).Compile(); GeometryShader gys; gys.Source(/* ... */).Compile(); FragmentShader fgs; fgs.Source(/* ... */).Compile(); Program prog; prog .AttachShader(vxs) .AttachShader(tcs) .AttachShader(tes) .AttachShader(gys) .AttachShader(fgs) .Link(); gl.Use(prog);
ProgramOps& operator << ( ProgramOps& program, ShaderName shader ); struct ProgAndXFBMode { ProgAndXFBMode(ProgramOps& p, TransformFeedbackMode m); }; ProgAndXFBMode operator << ( ProgramOps& prog, TransformFeedbackMode mode ); template <std::size_t N> ProgramOps& operator << ( ProgAndXFBMode pam, const GLchar* (&varyings)[N] ); struct ProgXFBModeAndNames { ProgXFBModeAndNames(ProgAndXFBMode pam, const GLchar* name); ProgXFBModeAndNames(ProgXFBModeAndNames&& pman, const GLchar* name); ProgXFBModeAndNames(ProgXFBModeAndNames&& tmp); }; ProgXFBModeAndNames operator << ( ProgAndXFBMode pam, const GLchar* name ); ProgXFBModeAndNames operator << ( ProgXFBModeAndNames&& pman, const GLchar* name );
The syntax sugar operators make attaching shaders to a program less verbose as shown here:
Context gl; VertexShader vxs; TessControlShader tcs; TessEvaluationShader tes; GeometryShader gys; FragmentShader fgs; /* ... */ Program prog; prog << vxs << tcs << tes << gys << fgs; prog.Link(); gl.Use(prog);
Equivalent to |
These operators also simplify the specification of transform feedback varyings:
Program prog; prog << VertexShader( ObjectDesc("Dist"), "#version 150\n" "uniform mat4 ProjectionMatrix, CameraMatrix;\n" "in vec4 Position;\n" "out uint xfbIndex;\n" "out float xfbDistance;\n" "void main(void)\n" "{\n" " vec4 p = ProjectionMatrix*CameraMatrix*Position;\n" " xfbIndex = uint(gl_VertexID);\n" " xfbDistance = p.z;\n" "}\n" ); prog << TransformFeedbackMode::SeparateAttribs << "xfbIndex" << "xfbDistance"; prog.Link();
Equivalent to calling |
#if GL_VERSION_4_1 || GL_ARB_separate_shader_objects class ShaderProgram : public Program { public: ShaderProgram( ShaderType shader_type, GLSLString&& source ); ShaderProgram( ShaderType shader_type, GLSLString&& source, ObjectDesc&& object_desc ); ShaderProgram( ShaderType shader_type, GLSLStrings&& source ); ShaderProgram( ShaderType shader_type, GLSLStrings&& source, ObjectDesc&& object_desc ); ShaderProgram( ShaderType shader_type, const GLSLSource& glsl_source ); ShaderProgram( ShaderType shader_type, const GLSLSource& glsl_source, ObjectDesc&& object_desc ); }; #endif
Creates a program with a single shader with specified type and source. Throws ValidationError. |
|
Creates a program with a single shader with specified type, source and description. Throws ValidationError. |
|
Creates a program with a single shader with specified type and source. Throws ValidationError. |
|
Creates a program with a single shader with specified type, source and description. Throws ValidationError. |
|
Creates a program with a single shader with specified type and source. Throws ValidationError. |
|
Creates a program with a single shader with specified type, source and description. Throws ValidationError. |
This class allows to supply a list of shaders and other parameters to the constructor. The shaders are attached to the Program and it is linked and made active. Optionally the program can also be made separable.
class QuickProgram : public Program { public: QuickProgram(const Sequence<ShaderName>& shaders); QuickProgram( ObjectDesc&& object_desc, const Sequence<ShaderName>& shaders ); #if GL_VERSION_4_1 || GL_ARB_separate_shader_objects QuickProgram(bool separable, const Sequence<ShaderName>& shaders); QuickProgram( ObjectDesc&& object_desc, bool separable, const Sequence<ShaderName>& shaders ); #endif };
Attaches |
|
Attaches |
|
Attaches |
|
Attaches |
#include
<oglplus/program_resource.hpp>
class ProgramResource { public: GLint GetIntParam(ProgramResourceProperty property) const; Boolean GetBoolParam(ProgramResourceProperty property) const; bool Has(ProgramResourceProperty property) const; ProgramInterface Interface(void) const; const String& Name(void) const; GLuint Index(void) const; bool HasType(void) const; SLDataType Type(void) const; GLint Location(void) const; GLint LocationIndex(void) const; GLint ArraySize(void) const; Boolean IsPerPatch(void) const; Boolean ReferencedBy(ShaderType shader_type) const; };
Gets the value of a single property (as a GLint). See |
|
Gets the value of a single property (as a boolean value). |
|
Checks if this resource has the specified property. |
|
Returns the interface of the resource. |
|
Returns the name of the resource. See |
|
Returns the index of the resource. |
|
Returns true if the resource has a type. |
|
Returns the data type of the resource (if applicable). See |
|
Returns the program resource location (if applicable). See |
|
Returns the program resource location index (if applicable). See |
|
Returns the array size of the resource (if applicable). See |
|
Returns true if the resource is per-patch (if applicable). See |
|
Returns true if the resource is referenced by shader of the specified type (if applicable). |