Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created January 13, 2014 11:11
Show Gist options
  • Save tuttlem/8398555 to your computer and use it in GitHub Desktop.
Save tuttlem/8398555 to your computer and use it in GitHub Desktop.
Texture class
class texture {
public:
// manage the generated texture id
texture(const GLuint t) : _reference(t) { }
// cleanup of the allocated resource
virtual ~texture(void);
// provide access to the reference
const GLuint reference() const { return _reference; }
private:
GLuint _reference;
};
texture::~texture(void) {
// only run if we have something to clean up
if (this->_reference != 0) {
// clear out the texture
glDeleteTextures(1, &this->_reference);
this->_reference = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment