Created
January 13, 2014 11:11
-
-
Save tuttlem/8398555 to your computer and use it in GitHub Desktop.
Texture class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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