1 #ifndef _REF_COUNTED_TEXTURE_H
2 #define _REF_COUNTED_TEXTURE_H 1
4 // A wrapper around an OpenGL texture that is automatically deleted.
9 struct TextureDeleter {
10 void operator() (GLuint *tex)
12 glDeleteTextures(1, tex);
17 typedef std::unique_ptr<GLuint, TextureDeleter> UniqueTexture;
18 typedef std::shared_ptr<GLuint> RefCountedTexture;
20 // TODO: consider mipmaps.
21 RefCountedTexture create_texture_2d(GLuint width, GLuint height, GLenum internal_format, GLenum format, GLenum type, const GLvoid *pixels);
23 #endif // !defined(_REF_COUNTED_TEXTURE)