13#ifndef ML_GLRESOURCES_H
14#define ML_GLRESOURCES_H
22ML_OPENGL_START_NAMESPACE
114 return static_cast<GLsizei
>(_ids.size());
120 return !_ids.empty();
136 std::vector<GLuint> _ids;
333 : _shaderType(shaderType)
368 : _shaderType(GL_NONE)
373 GLSLShader(
const GLSLShader&)
376 GLSLShader& operator=(
const GLSLShader&)
402 GLSLVertexShader& operator=(
const GLSLVertexShader&)
425 GLSLFragmentShader& operator=(
const GLSLFragmentShader&)
448 GLSLGeometryShader& operator=(
const GLSLGeometryShader&)
509 GLSLProgram& operator=(
const GLSLProgram&)
516ML_OPENGL_END_NAMESPACE
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.
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.
~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).
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
Abstract base class for GLResources.
GLResource(const GLResource &)=delete
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.
GLResource & operator=(const GLResource &)=delete
GLResource(GLResource &&) noexcept=delete
friend class GLResourceManager
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.
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.
#define MLOPENGL_EXPORT
Closes the namespace for all ML code after the usage of ML_UTILS_START_NAMESPACE.