AvogadroLibs  1.96.0
Public Types | Public Member Functions | Protected Attributes | List of all members
Shader Class Reference

Vertex or Fragment shader, combined into a ShaderProgram. More...

#include <avogadro/rendering/shader.h>

Public Types

enum  Type {
  Vertex ,
  Fragment ,
  Unknown
}
 

Public Member Functions

 Shader (Type type=Unknown, const std::string &source="")
 
void setType (Type type)
 
Type type () const
 
void setSource (const std::string &source)
 
std::string source () const
 
std::string error () const
 
Index handle () const
 
bool compile ()
 
void cleanup ()
 

Protected Attributes

Type m_type
 
Index m_handle
 
bool m_dirty
 
std::string m_source
 
std::string m_error
 

Detailed Description

Author
Marcus D. Hanwell

This class creates a Vertex or Fragment shader, that can be attached to a ShaderProgram in order to render geometry etc.

Member Enumeration Documentation

◆ Type

enum Type

Available shader types.

Enumerator
Vertex 

Vertex shader

Fragment 

Fragment shader

Unknown 

Unknown (default)

Member Function Documentation

◆ setType()

void setType ( Type  type)

Set the shader type.

◆ type()

Type type ( ) const

Get the shader type, typically Vertex or Fragment.

◆ setSource()

void setSource ( const std::string &  source)

Set the shader source to the supplied string.

◆ source()

std::string source ( ) const

Get the source for the shader.

◆ error()

std::string error ( ) const

Get the error message (empty if none) for the shader.

◆ handle()

Index handle ( ) const

Get the handle of the shader.

◆ compile()

bool compile ( )

Compile the shader.

Note
A valid context must to current in order to compile the shader.

◆ cleanup()

void cleanup ( )

Delete the shader.

Note
This should only be done once the ShaderProgram is done with the Shader.

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