GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
Glip::CoreGL::HdlShader Class Reference

Object handle for OpenGL Shaders Objects (both vertex and fragment shaders). More...

#include <HdlShader.hpp>

Inheritance diagram for Glip::CoreGL::HdlShader:
Inheritance graph

Public Member Functions

 HdlShader (GLenum _type, const ShaderSource &src)
 HdlShader constructor. More...
 
GLuint getShaderID (void) const
 Returns the ID of the shader for OpenGL. More...
 
GLenum getType (void) const
 Returns the type of the shader for OpenGL. More...
 
- Public Member Functions inherited from Glip::CoreGL::ShaderSource
 ShaderSource (const std::string &src, const std::string &_sourceName="", int startLine=1, const std::map< int, LineInfo > &_linesInfo=std::map< int, LineInfo >())
 Constructor of ShaderSource, load from a standard string or a file. More...
 
 ShaderSource (const ShaderSource &ss)
 ShaderSource Construtor. More...
 
ShaderSourceoperator= (const ShaderSource &c)
 Copy operator. More...
 
bool empty (void) const
 Test if the source is empty. More...
 
const std::string & getSource (void) const
 Returns the source as a standard string. More...
 
const std::string & getSourceName (void) const
 Return the name of the source : the one given with the constructor if any, the filename if it was loaded from a file or a blank string otherwise. More...
 
const char * getSourceCstr (void) const
 Returns the source as a characters table. More...
 
int getNumLines (void) const
 Get the number of lines in this source. More...
 
std::string getLine (int l, bool withNewLine=true) const
 Get a specific line from the source. More...
 
LineInfo getLineInfo (int l) const
 Get information about the line at the given index. More...
 
Exception errorLog (const std::string &log) const
 Add some source code information to the output shader compilation log. More...
 
bool requiresCompatibility (void) const
 Returns true if this Shader is using gl_FragColor and no out vec4 variables (e.g. Mesa <9.0 compatibility for Intel Core I7 with HD Graphics (>2nd Generation)); no call to glBindFragDataLocation is needed). If true, the input vars are indexed on their order of appearance in the shader source. More...
 
int getVersion (void) const
 Returns the shader version defined in the source (with #version) as an integer. More...
 
const std::vector< std::string > & getInputVars (void) const
 Return a vector containing the name of all the input textures (uniform sampler*). More...
 
const std::vector< std::string > & getOutputVars (void) const
 Return a vector containing the name of all the output textures (uniform {vec2, vec3, vec4, ...}). More...
 
const std::vector< std::string > & getUniformVars (void) const
 Return a vector containing the name of all the uniform variables which are not 2D samplers. More...
 
const std::vector< GLenum > & getUniformTypes (void) const
 Return a vector containing the type of the uniform variables which are not 2D samplers (see http://www.opengl.org/sdk/docs/man/xhtml/glGetActiveUniform.xml for a table of possible values). More...
 

Additional Inherited Members

- Public Attributes inherited from Glip::CoreGL::ShaderSource
std::map< int, LineInfolinesInfo
 Map containing information about specific lines of this source. The key represent the line number starting at 1.
 
- Static Public Attributes inherited from Glip::CoreGL::ShaderSource
static std::string portNameForFragColor = "outputTexture"
 Name for the port mapping to gl_FragColor, if used.
 

Detailed Description

Object handle for OpenGL Shaders Objects (both vertex and fragment shaders).

Constructor & Destructor Documentation

HdlShader::HdlShader ( GLenum  _type,
const ShaderSource src 
)

HdlShader constructor.

Parameters
_typeThe kind of shader it will be : GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER.
srcThe source code used.

Member Function Documentation

GLuint HdlShader::getShaderID ( void  ) const

Returns the ID of the shader for OpenGL.

Returns
The ID handled by the driver.
GLenum HdlShader::getType ( void  ) const

Returns the type of the shader for OpenGL.

Return the type of the shader, among : GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_COMPUTE_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER.

Returns
The type of this shader.

The documentation for this class was generated from the following files: