The class representation of textures on this engine, which are a type of Resource used both within and outside of the engine.
More...
#include <texture.hpp>
|
| Texture (GLuint textureID, const ColorBufferDefinition &colorBufferDefinition, const std::string &filepath="") |
| Constructs a new texture object which takes ownership of an OpenGL texture handle and engine colorbuffer definition created outside of it.
|
|
| Texture (const Texture &other) |
|
Texture & | operator= (const Texture &other) |
|
| Texture (Texture &&other) noexcept |
|
Texture & | operator= (Texture &&other) noexcept |
|
virtual void | free () |
|
void | bind (GLuint textureUnit) const |
| Binds this texture to a texture unit, making it available for use by a shader.
|
|
void | attachToFramebuffer (GLuint attachmentUnit) const |
| Attaches this texture to a (presumably existing and bound) framebuffer, allowing the user of the framebuffer to read from and render to it.
|
|
GLuint | getTextureID () const |
| Gets the OpenGL texture ID for this texture.
|
|
GLint | getWidth () const |
| Gets the width of this texture (per its color buffer definition).
|
|
GLint | getHeight () const |
| Gets the height of this texture (per its color buffer definition).
|
|
ColorBufferDefinition | getColorBufferDefinition () |
| Gets the description of this texture.
|
|
std::string | getResourceTypeName_ () const override |
| Get the resource type string for this resource.
|
|
virtual | ~IResource ()=default |
| Destroy the IResource object.
|
|
|
static std::string | getResourceTypeName () |
| Gets the resource type string associated with this resource.
|
|
|
void | copyImage (const Texture &other) |
|
void | generateTexture () |
| Generates a new texture based on the stored color buffer definition.
|
|
GLenum | internalFormat () |
| The enum value passed as the "internalFormat" argument of glTexImage2D.
|
|
GLenum | externalFormat () |
| The enum value passed as the "format" argument of glTexImage2D.
|
|
void | destroyResource () |
| Destroys (OpenGL managed) texture tied to this object.
|
|
void | releaseResource () |
| Removes references to (OpenGL managed) texture tied to this object, so that another object or part of the program can take ownership of it.
|
|
| Resource (int explicitlyInitializeMe) |
| Construct a new resource object.
|
|
| IResource ()=default |
| Construct a new IResource object.
|
|
|
GLuint | mID {0} |
| The OpenGL ID of this texture.
|
|
std::string | mFilepath {""} |
| The file this texture was loaded from, if any.
|
|
ColorBufferDefinition | mColorBufferDefinition |
| The color buffer definition of this texture.
|
|
The class representation of textures on this engine, which are a type of Resource used both within and outside of the engine.
◆ Texture()
Texture::Texture |
( |
GLuint | textureID, |
|
|
const ColorBufferDefinition & | colorBufferDefinition, |
|
|
const std::string & | filepath = "" ) |
Constructs a new texture object which takes ownership of an OpenGL texture handle and engine colorbuffer definition created outside of it.
- Parameters
-
textureID | The ID of the texture now to be owned by this object. |
colorBufferDefinition | The color buffer definition for this object. |
filepath | The path to the file the texture was loaded from, if any. |
◆ attachToFramebuffer()
void Texture::attachToFramebuffer |
( |
GLuint | attachmentUnit | ) |
const |
Attaches this texture to a (presumably existing and bound) framebuffer, allowing the user of the framebuffer to read from and render to it.
- Parameters
-
attachmentUnit | The attachment unit to which this texture will be bound. |
◆ bind()
void Texture::bind |
( |
GLuint | textureUnit | ) |
const |
Binds this texture to a texture unit, making it available for use by a shader.
- Parameters
-
textureUnit | The unit this texture is to be bound to. |
◆ externalFormat()
GLenum Texture::externalFormat |
( |
| ) |
|
|
protected |
The enum value passed as the "format" argument of glTexImage2D.
- Returns
- GLenum The enum value corresponding to glTexImage2D's "format" argument.
◆ getColorBufferDefinition()
Gets the description of this texture.
- Returns
- ColorBufferDefinition This texture's color buffer definition.
◆ getHeight()
GLint Texture::getHeight |
( |
| ) |
const |
Gets the height of this texture (per its color buffer definition).
- Returns
- GLint This texture's height.
◆ getResourceTypeName()
static std::string ToyMaker::Texture::getResourceTypeName |
( |
| ) |
|
|
inlinestatic |
Gets the resource type string associated with this resource.
- Returns
- std::string The resource type string of this object.
◆ getTextureID()
GLuint Texture::getTextureID |
( |
| ) |
const |
Gets the OpenGL texture ID for this texture.
- Returns
- GLuint This texture's OpenGL texture id.
◆ getWidth()
GLint Texture::getWidth |
( |
| ) |
const |
Gets the width of this texture (per its color buffer definition).
- Returns
- GLint This texture's width.
◆ internalFormat()
GLenum Texture::internalFormat |
( |
| ) |
|
|
protected |
The enum value passed as the "internalFormat" argument of glTexImage2D.
- Returns
- GLenum The enum value corresponding to glTexImage2D's "internalFormat" argument.
The documentation for this class was generated from the following files: