13 #ifndef ML_GLRESOURCES_H
14 #define ML_GLRESOURCES_H
88 bool isValid()
const {
return !_ids.empty(); }
91 void create(GLsizei numberOfTextures);
100 std::vector<GLuint> _ids;
229 GLSLShader(GLenum shaderType) : _shaderType(shaderType), _id(0) {}
236 inline bool isValid()
const {
return _id!=0; }
249 GLSLShader() : _shaderType(GL_NONE), _id(0) {}
319 inline bool isValid()
const {
return _id!=0; }
Manages a generic OpenGL buffer object.
void contextDestroyed() override
Forgets the resource; the context was destroyed.
bool isValid() const
Checks whether the program is valid.
GLuint getHandle() const
Returns the buffers's handle (you need to create() the buffer before you get a handle).
void create()
Creates the pixel buffer (requires valid GL context).
void destroy()
Destroys the resource.
ARB_FRAGMENT_PROGRAM resource.
void destroy()
Destroys the resource.
void contextDestroyed() override
Forgets the resource; the context was destroyed.
~GLFragmentProgramARB() override
GLuint getHandle() const
Returns the program's handle (you need to create() the texture before you get a handle).
bool isValid() const
Checks whether the program is valid.
void create()
Creates the program (requires valid GL context).
FrameBufferObject resource (frame_buffer_object extension)
~GLFrameBuffer() override
void destroy()
Destroys the resource.
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
bool isValid() const
Checks whether the program is valid.
void create()
Creates the program (requires valid GL context).
void contextDestroyed() override
Forgets the resource; the context was destroyed.
PixelBuffer resource (pixel_buffer_object).
RenderBuffer resource (frame_buffer_object extension)
void create()
Creates the program (requires valid GL context).
void destroy()
Destroys the resource.
void contextDestroyed() override
Forgets the resource; the context was destroyed.
bool isValid() const
Check whether the program is valid.
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
~GLRenderBuffer() override
Manages OpenGL resources.
Collection of OpenGL related resource classes, such as textures, buffers, fragment programs etc.
virtual void contextDestroyed()=0
Forgets the resource; the context was destroyed.
static GLenum getGLError()
Checks for OpenGL error (returns GL_INVALID_OPERATION if there is no valid OpenGL context).
GLSL FragmentShader resource.
~GLSLFragmentShader() override
GLSL GeometryShader resource.
~GLSLGeometryShader() override
bool isValid() const
Checks whether the program is valid.
void detachShader(GLSLShader &shader)
Detaches the given shader (this is safe to be called outside of a valid GL context).
void destroy()
Destroys the resource.
void detachShader(GLuint shader)
Detaches the given shader (this is safe to be called outside of a valid GL context).
void disable()
Disables program.
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void create()
Creates the program (requires valid GL context).
void contextDestroyed() override
Forgets the resource; the context was destroyed.
GLSLShader(GLenum shaderType)
void create()
Creates the program (requires valid GL context).
bool isValid() const
Checks whether the program is valid.
void destroy()
Destroys the resource.
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
GLSL VertexShader resource.
~GLSLVertexShader() override
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void create()
Creates the texture (requires valid GL context).
GLuint getHandle() const
Returns the texture's handle (you need to create() the texture before you get a handle).
bool isValid() const
Checks whether the texture is valid.
void destroy()
Destroys the resource.
Texture class that manages multiple texture IDs.
GLuint getHandle(GLsizei i) const
Returns the texture's handle (you need to create() the texture before you get a handle).
void destroy()
Destroys the resource.
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void create(GLsizei numberOfTextures)
Creates the textures (requires valid GL context).
GLsizei getNumTextures() const
Returns the number of created textures.
bool isValid() const
Checks whether the texture is valid.
VertexBuffer resource (vertex_buffer_object extension).
#define ML_OPENGL_END_NAMESPACE
Closes the namespace for all ML code after the usage of ML_UTILS_START_NAMESPACE.
#define ML_OPENGL_START_NAMESPACE
Macro to put all following code into the namespace ML_NAMESPACE to avoid collisions with symbols of o...
void destroy()
Delete dynamic data structures allocated by init().