A child of Texture which allows (and gives helpful functions for) mutation. More...
#include <MutableTexture.hpp>
Inheritance diagram for BARE2D::MutableTexture:
Collaboration diagram for BARE2D::MutableTexture:Public Member Functions | |
| void | setData (unsigned char *data) |
| Sets the data of the mutable texture, as well as updates the OpenGL context's texture data for it (uses glTextureSubImage2D). More... | |
| void | setData (unsigned char *data, unsigned int xOffset, unsigned int yOffset, unsigned int subWidth, unsigned int subHeight) |
| Sets the data of the mutable texture, as well as updates the OpenGL context's texture data for it (uses glTextureSubImage2D). More... | |
Data Fields | |
| GLenum | format = GL_RGBA |
| unsigned int | channels = 4 |
Data Fields inherited from BARE2D::Texture | |
| std::string | filepath = "" |
| GLuint | id = 0 |
| int | width = 0 |
| int | height = 0 |
A child of Texture which allows (and gives helpful functions for) mutation.
Definition at line 13 of file MutableTexture.hpp.
| void BARE2D::MutableTexture::setData | ( | unsigned char * | data | ) |
Sets the data of the mutable texture, as well as updates the OpenGL context's texture data for it (uses glTextureSubImage2D).
| data | The data (formatted R0,G0,B0,A0,R1,G1,B1,A0,etc.). Assumes width and height of data are equal to that of the texture. |
| format | The format of the data. Must follow OpenGL Formats (GL_RED, GL_RG, etc.). Defaults to GL_RGBA |
Definition at line 9 of file MutableTexture.cpp.
References BARE2D::Texture::height, and BARE2D::Texture::width.
| void BARE2D::MutableTexture::setData | ( | unsigned char * | data, |
| unsigned int | xOffset, | ||
| unsigned int | yOffset, | ||
| unsigned int | subWidth, | ||
| unsigned int | subHeight | ||
| ) |
Sets the data of the mutable texture, as well as updates the OpenGL context's texture data for it (uses glTextureSubImage2D).
| data | The data (default formatted R0,G0,B0,A0,R1,G1,B1,A0,etc.). |
| xOffset | How far in from the x side the texture should be overwritten |
| yOffset | How far in from the y side the texture should be overwritten |
| width | The width of the data |
| height | The height of the data |
| format | The format of the data. Must follow OpenGL Formats (GL_RED, GL_RG, etc.). Defaults to GL_RGBA |
Definition at line 13 of file MutableTexture.cpp.
References BARE2D::GLContext::bindTexture(), channels, format, and BARE2D::GLContextManager::getContext().
Here is the call graph for this function:| unsigned int BARE2D::MutableTexture::channels = 4 |
Definition at line 37 of file MutableTexture.hpp.
Referenced by BARE2D::ResourceManager::createMutableTexture(), and setData().
| GLenum BARE2D::MutableTexture::format = GL_RGBA |
Definition at line 36 of file MutableTexture.hpp.
Referenced by BARE2D::ResourceManager::createMutableTexture(), and setData().