Unofficial OpenGL Software Development Kit: glutil::UniqueShader Class Reference

Unofficial OpenGL Software Development Kit 0.5.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members | Public Member Functions
glutil::UniqueShader Class Reference
Program Compilation/Linking

`#include <Shader.h>`

Inherits noncopyable.

##

RAII object for managing a shader object.

This object manages the lifetime of a shader object. It represents a uniquely-owned shader object. It is implicitly convertible to GLuint, so you can use it more or less wherever you used a GLuint before.

It is explicitly non-copyable. C++11 would eventually allow move-semantics, but that's not widely available enough to directly support. If you need to transfer ownership, it is swappable, so you'll have to make due with using `swap`.

This RAII-style class makes it easy to be exception-safe with shader objects.

Todo:
  : Implement C++11 move semantics.

## Public Member Functions

| UniqueShader ()
| An empty UniqueShader, with shader name 0.
| UniqueShader (GLuint shader)
| Create a UniqueShader from an existing shader object.
| ~UniqueShader ()
| Destroys the owned shader object, if any.
void | swap (UniqueShader &other)
| Exchanges shader ownership between the two objects.
| operator GLuint () const
| Implicit conversion to shader object.
void | reset (GLuint newShader=0)
| The given shader becomes the current shader; the old one is deleted.
GLuint | release ()
| Abandons ownership of the currently-owned shader object. More...

## Member Function Documentation

GLuint glutil::UniqueShader::release | ( |  | ) |

inline

Abandons ownership of the currently-owned shader object.

After calling this function, the shader object will be unowned. It will not have been destroyed.

Returns
  The shader object that used to be owned.

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

- C:/Projects/distro/glsdk_0_5_1/glutil/include/glutil/Shader.h