• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KWin

KGLLib::Shader

KGLLib::Shader Class Reference

#include <shader.h>

Inheritance diagram for KGLLib::Shader:

Inheritance graph
[legend]

List of all members.


Detailed Description

Shader class.

Encapsulates a shader object. Note that shaders are only intermediate objects used to create Program objects. For simple use cases, you can use Program class which can automatically create and use necessary Shader objects.

Definition at line 38 of file shader.h.


Public Member Functions

bool compile ()
char * compileLog () const
GLuint glId () const
bool isCompiled () const
bool isValid () const
void setSource (const QByteArray &source)
void setSource (const QString &source)
 Shader (GLenum type, const QString &filename)
 Shader (GLenum type)
GLenum type () const
virtual ~Shader ()

Protected Member Functions

void init (GLenum type)

Protected Attributes

bool mCompiled
char * mCompileLog
GLuint mGLId
GLenum mType
bool mValid

Constructor & Destructor Documentation

KGLLib::Shader::Shader ( GLenum  type  ) 

Creates a shader of given type.

You need to manually call setSource() and compile() before the shader can be added to a Program.

Definition at line 26 of file shader.cpp.

KGLLib::Shader::Shader ( GLenum  type,
const QString &  filename 
)

Loads shader of given type from given file.

Loaded shader is automatically compiled, so if the compilation succeeds, you can add it to a Program object.

Definition at line 31 of file shader.cpp.

KGLLib::Shader::~Shader (  )  [virtual]

Deletes a shader.

Shaders can be deleted after they are added to a Program and the program is linked.

Definition at line 44 of file shader.cpp.


Member Function Documentation

bool KGLLib::Shader::compile (  ) 

Compiles the shader.

If compilation succeeds, you can add it to a Program object. If compilation fails, you can see the error using compileLog() method.

Definition at line 74 of file shader.cpp.

char* KGLLib::Shader::compileLog (  )  const [inline]

Returns:
Compile log of the shader or null if there was none or the shader hasn't been compiled.

Note that Shader keeps ownership of the returned string, so you mustn't delete it. TODO: maybe return QString?

Definition at line 83 of file shader.h.

GLuint KGLLib::Shader::glId (  )  const [inline]

Definition at line 86 of file shader.h.

void KGLLib::Shader::init ( GLenum  type  )  [protected]

Definition at line 50 of file shader.cpp.

bool KGLLib::Shader::isCompiled (  )  const [inline]

Definition at line 75 of file shader.h.

bool KGLLib::Shader::isValid (  )  const [inline]

Definition at line 74 of file shader.h.

void KGLLib::Shader::setSource ( const QByteArray &  source  ) 

Definition at line 64 of file shader.cpp.

void KGLLib::Shader::setSource ( const QString &  source  ) 

Sets shader source to source.

Next you will need to compile the shader.

Definition at line 59 of file shader.cpp.

GLenum KGLLib::Shader::type (  )  const [inline]

Definition at line 85 of file shader.h.


Member Data Documentation

bool KGLLib::Shader::mCompiled [protected]

Definition at line 96 of file shader.h.

char* KGLLib::Shader::mCompileLog [protected]

Definition at line 97 of file shader.h.

GLuint KGLLib::Shader::mGLId [protected]

Definition at line 93 of file shader.h.

GLenum KGLLib::Shader::mType [protected]

Definition at line 94 of file shader.h.

bool KGLLib::Shader::mValid [protected]

Definition at line 95 of file shader.h.


The documentation for this class was generated from the following files:
  • shader.h
  • shader.cpp

KWin

Skip menu "KWin"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal