SurgSim::Graphics::Program Class Referenceabstract

Base class that defines the interface for graphics programs. More...

`#include <SurgSim/Graphics/Program.h>`

Inheritance diagram for SurgSim::Graphics::Program:

## Public Member Functions

virtual | ~Program ()=0
| Destructor. More...
virtual bool | hasVertexShader () const =0
virtual void | clearVertexShader ()=0
| Removes the vertex shader, returning that portion of the shader program to fixed-function. More...
virtual bool | loadVertexShader (const std::string &filePath)=0
| Loads the vertex shader source code from a file. More...
virtual void | setVertexShaderSource (const std::string &source)=0
| Set the vertex shader source code. More...
virtual bool | getVertexShaderSource (std::string *source) const =0
| Gets the vertex shader source code. More...
virtual bool | hasGeometryShader () const =0
virtual void | clearGeometryShader ()=0
| Removes the geometry shader, returning that portion of the shader program to fixed-function. More...
virtual bool | loadGeometryShader (const std::string &filePath)=0
| Loads the geometry shader source code from a file. More...
virtual void | setGeometryShaderSource (const std::string &source)=0
| Set the geometry shader source code. More...
virtual bool | getGeometryShaderSource (std::string *source) const =0
| Gets the geometry shader source code. More...
virtual bool | hasFragmentShader () const =0
virtual void | clearFragmentShader ()=0
virtual bool | loadFragmentShader (const std::string &filePath)=0
| Loads the fragment shader source code from a file. More...
virtual void | setFragmentShaderSource (const std::string &source)=0
| Set the fragment shader source code. More...
virtual bool | getFragmentShaderSource (std::string *source) const =0
| Gets the fragment shader source code. More...
virtual void | clear ()
| Clears the entire shader, returning to fixed-function pipeline. More...
virtual void | setGlobalScope (bool val)=0
| When this is set to true, this shader should be used instead of other shaders that might apply, depending on the hierarchy that is set out. More...
virtual bool | isGlobalScope () const =0
| Query if this shader is of global scope. More...

## Detailed Description

Base class that defines the interface for graphics programs.

A program in OSS is a collection of 'shaders' that are usually executed in sequence (Geometry, Vertex and Fragment). Each shader itself is software that is executed on the GPU, shaders are usually introduced as source. The concept is similar to the use of program in OpenGL see https://www.opengl.org/sdk/docs/man4/html/glCreateProgram.xhtml

## Constructor & Destructor Documentation

## ~Program()

SurgSim::Graphics::Program::~Program | ( |  | ) |

inline pure virtual

Destructor.

## Member Function Documentation

## clear()

virtual void SurgSim::Graphics::Program::clear | ( |  | ) |

inline virtual

Clears the entire shader, returning to fixed-function pipeline.

## clearFragmentShader()

virtual void SurgSim::Graphics::Program::clearFragmentShader | ( |  | ) |

pure virtual

Returns
  the fragment shader, returning that portion of the shader program to fixed-function.

Implemented in SurgSim::Graphics::OsgProgram.

## clearGeometryShader()

virtual void SurgSim::Graphics::Program::clearGeometryShader | ( |  | ) |

pure virtual

Removes the geometry shader, returning that portion of the shader program to fixed-function.

Implemented in SurgSim::Graphics::OsgProgram.

## clearVertexShader()

virtual void SurgSim::Graphics::Program::clearVertexShader | ( |  | ) |

pure virtual

Removes the vertex shader, returning that portion of the shader program to fixed-function.

Implemented in SurgSim::Graphics::OsgProgram.

## getFragmentShaderSource()

virtual bool SurgSim::Graphics::Program::getFragmentShaderSource | ( | std::string * | source | ) | const

pure virtual

Gets the fragment shader source code.

Returns
  Shader source code

Implemented in SurgSim::Graphics::OsgProgram.

## getGeometryShaderSource()

virtual bool SurgSim::Graphics::Program::getGeometryShaderSource | ( | std::string * | source | ) | const

pure virtual

Gets the geometry shader source code.

Returns
  Shader source code

Implemented in SurgSim::Graphics::OsgProgram.

## getVertexShaderSource()

virtual bool SurgSim::Graphics::Program::getVertexShaderSource | ( | std::string * | source | ) | const

pure virtual

Gets the vertex shader source code.

Returns
  Shader source code

Implemented in SurgSim::Graphics::OsgProgram.

## hasFragmentShader()

virtual bool SurgSim::Graphics::Program::hasFragmentShader | ( |  | ) | const

pure virtual

Returns
  true if the fragment shader has been set, otherwise false.

Implemented in SurgSim::Graphics::OsgProgram.

## hasGeometryShader()

virtual bool SurgSim::Graphics::Program::hasGeometryShader | ( |  | ) | const

pure virtual

Returns
  true if the geometry shader has been set, otherwise false.

Implemented in SurgSim::Graphics::OsgProgram.

## hasVertexShader()

virtual bool SurgSim::Graphics::Program::hasVertexShader | ( |  | ) | const

pure virtual

Returns
  true if the vertex shader has been set, otherwise false.

Implemented in SurgSim::Graphics::OsgProgram.

## isGlobalScope()

virtual bool SurgSim::Graphics::Program::isGlobalScope | ( |  | ) | const

pure virtual

Query if this shader is of global scope.

Returns
  true if global scope, false if not.

Implemented in SurgSim::Graphics::OsgProgram.

## loadFragmentShader()

virtual bool SurgSim::Graphics::Program::loadFragmentShader | ( | const std::string & | filePath | ) |

pure virtual

Loads the fragment shader source code from a file.

Parameters

  filePath | Path to file containing shader source code

Returns
  True if the source is successfully loaded, otherwise false.

Implemented in SurgSim::Graphics::OsgProgram.

## loadGeometryShader()

virtual bool SurgSim::Graphics::Program::loadGeometryShader | ( | const std::string & | filePath | ) |

pure virtual

Loads the geometry shader source code from a file.

Parameters

  filePath | Path to file containing shader source code

Returns
  True if the source is successfully loaded, otherwise false.

Implemented in SurgSim::Graphics::OsgProgram.

## loadVertexShader()

virtual bool SurgSim::Graphics::Program::loadVertexShader | ( | const std::string & | filePath | ) |

pure virtual

Loads the vertex shader source code from a file.

Parameters

  filePath | Path to file containing shader source code

Returns
  True if the source is successfully loaded, otherwise false.

Implemented in SurgSim::Graphics::OsgProgram.

## setFragmentShaderSource()

virtual void SurgSim::Graphics::Program::setFragmentShaderSource | ( | const std::string & | source | ) |

pure virtual

Set the fragment shader source code.

Parameters

  source | Shader source code

Implemented in SurgSim::Graphics::OsgProgram.

## setGeometryShaderSource()

virtual void SurgSim::Graphics::Program::setGeometryShaderSource | ( | const std::string & | source | ) |

pure virtual

Set the geometry shader source code.

Parameters

  source | Shader source code

Implemented in SurgSim::Graphics::OsgProgram.

## setGlobalScope()

virtual void SurgSim::Graphics::Program::setGlobalScope | ( | bool | val | ) |

pure virtual

When this is set to true, this shader should be used instead of other shaders that might apply, depending on the hierarchy that is set out.

E.g if this shader is on a camera, the shaders that occur in a group attached to that camera will be overridden. This will usually be used in conjunction with

See also
  RenderPass.

Parameters

  val | If true the shader should override shaders in lower levels.

Implemented in SurgSim::Graphics::OsgProgram.

## setVertexShaderSource()

virtual void SurgSim::Graphics::Program::setVertexShaderSource | ( | const std::string & | source | ) |

pure virtual

Set the vertex shader source code.

Parameters

  source | Shader source code

Implemented in SurgSim::Graphics::OsgProgram.

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

- SurgSim/Graphics/Program.h