8 #ifndef META_OCEAN_PLATFORM_GL_GL_TEXTURE_H
9 #define META_OCEAN_PLATFORM_GL_GL_TEXTURE_H
53 inline GLuint id()
const;
70 bool update(
const Frame& frame,
const bool enableFiltering =
true);
89 bool bindToProgram(
const GLuint programId,
const std::string& attributeName,
const unsigned int index = 0u);
105 inline const FrameType& frameType()
const;
111 explicit inline operator bool()
const;
140 ocean_assert(GL_NO_ERROR == glGetError());
142 ocean_assert(GL_NO_ERROR == glGetError());
147 ocean_assert(GL_NO_ERROR == glGetError());
148 glBindTexture(GL_TEXTURE_2D, 0);
149 ocean_assert(GL_NO_ERROR == glGetError());
157 inline Texture::operator bool()
const
159 return textureId != 0u;
This class implements Ocean's image class.
Definition: Frame.h:1792
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition: Frame.h:30
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
This class implements the base class for all object which have an associated context.
Definition: ContextAssociated.h:31
This class implements a 2D OpenGL texture.
Definition: platform/gl/Texture.h:30
~Texture()
Destructs a texture.
GLuint id() const
Returns the id of the texture.
Definition: platform/gl/Texture.h:133
bool update(const Frame &frame, const bool enableFiltering=true)
Sets the image content of the texture.
void updateMipmap()
Generates mipmaps.
FrameType textureFrameType
The frame type of the texture.
Definition: platform/gl/Texture.h:130
GLuint textureId
The OpenGL texture id.
Definition: platform/gl/Texture.h:124
static GLenum pixelFormat2textureFormat(const FrameType::PixelFormat pixelFormat, GLint *internalFormat=nullptr)
Translates a pixel format to a corresponding OpenGL texture format.
Texture(const Frame &frame)
Creates a new OpenGL texture object.
void release()
Releases the texture.
void bind()
Bind this texture.
Definition: platform/gl/Texture.h:138
Texture()
Creates a new OpenGL texture object.
const FrameType & frameType() const
Returns the frame type of this texture object.
Definition: platform/gl/Texture.h:152
bool bindToProgram(const GLuint programId, const std::string &attributeName, const unsigned int index=0u)
Bind this texture to a given shader program.
bool resize(const FrameType &frameType, const bool enableFiltering=true)
Resizes the texture.
GLuint textureFormat
OpenGL texture (pixel) format.
Definition: platform/gl/Texture.h:127
void unbind()
Unbinds this texture.
Definition: platform/gl/Texture.h:145
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15