13 #ifndef ML_GLRESOURCES_H
14 #define ML_GLRESOURCES_H
22 ML_OPENGL_START_NAMESPACE
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) {}
252 GLSLShader(
const GLSLShader &) : GLResource() {}
253 GLSLShader &operator = (
const GLSLShader &) {
return *
this; }
269 GLSLVertexShader &operator = (
const GLSLVertexShader &) {
return *
this; }
282 GLSLFragmentShader &operator = (
const GLSLFragmentShader &) {
return *
this; }
295 GLSLGeometryShader &operator = (
const GLSLGeometryShader &) {
return *
this; }
319 inline bool isValid()
const {
return _id!=0; }
335 GLSLProgram &operator = (
const GLSLProgram &) {
return *
this; }
340 ML_OPENGL_END_NAMESPACE
Manages a generic OpenGL buffer object.
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 contextDestroyed() override
Forgets the resource; the context was destroyed.
void create()
Creates the pixel buffer (requires valid GL context).
void destroy()
Destroys the resource.
ARB_FRAGMENT_PROGRAM resource.
void destroy()
Destroys the resource.
~GLFragmentProgramARB() override
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void create()
Creates the program (requires valid GL context).
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.
FrameBufferObject resource (frame_buffer_object extension)
~GLFrameBuffer() override
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void destroy()
Destroys the resource.
void create()
Creates the program (requires valid GL context).
bool isValid() const
Checks whether the program is valid.
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
PixelBuffer resource (pixel_buffer_object).
RenderBuffer resource (frame_buffer_object extension)
bool isValid() const
Check whether the program is valid.
void destroy()
Destroys the resource.
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void create()
Creates the program (requires valid GL context).
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
~GLRenderBuffer() override
Manages OpenGL resources.
Abstract base class for GLResources.
static GLenum getGLError()
Checks for OpenGL error (returns GL_INVALID_OPERATION if there is no valid OpenGL context).
virtual void contextDestroyed()=0
Forgets the resource; the context was destroyed.
GLSL FragmentShader resource.
~GLSLFragmentShader() override
GLSL GeometryShader resource.
~GLSLGeometryShader() override
bool isValid() const
Checks whether the program is valid.
GLuint getHandle() const
Returns the program's handle (you need to create() the buffer before you get a handle).
void create()
Creates the program (requires valid GL context).
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 disable()
Disables program.
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void detachShader(GLuint shader)
Detaches the given shader (this is safe to be called outside of a valid GL context).
void create()
Creates the program (requires valid GL context).
void destroy()
Destroys the resource.
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.
bool isValid() const
Checks whether the program is valid.
GLSLShader(GLenum shaderType)
GLSL VertexShader resource.
~GLSLVertexShader() override
void destroy()
Destroys the resource.
GLuint getHandle() const
Returns the texture's handle (you need to create() the texture before you get a handle).
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void create()
Creates the texture (requires valid GL context).
bool isValid() const
Checks whether the texture is valid.
Texture class that manages multiple texture IDs.
void create(GLsizei numberOfTextures)
Creates the textures (requires valid GL context).
void contextDestroyed() override
Forgets the resource; the context was destroyed.
void destroy()
Destroys the resource.
GLuint getHandle(GLsizei i) 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.
GLsizei getNumTextures() const
Returns the number of created textures.
VertexBuffer resource (vertex_buffer_object extension).
#define MLOPENGL_EXPORT
Macro to put all following code into the namespace ML_NAMESPACE to avoid collisions with symbols of o...