BARE2D
BARE2D::MutableTexture Class Reference

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
 

Detailed Description

A child of Texture which allows (and gives helpful functions for) mutation.

Definition at line 13 of file MutableTexture.hpp.

Member Function Documentation

◆ setData() [1/2]

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).

Parameters
dataThe data (formatted R0,G0,B0,A0,R1,G1,B1,A0,etc.). Assumes width and height of data are equal to that of the texture.
formatThe 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.

◆ setData() [2/2]

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).

Parameters
dataThe data (default formatted R0,G0,B0,A0,R1,G1,B1,A0,etc.).
xOffsetHow far in from the x side the texture should be overwritten
yOffsetHow far in from the y side the texture should be overwritten
widthThe width of the data
heightThe height of the data
formatThe 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:

Field Documentation

◆ channels

unsigned int BARE2D::MutableTexture::channels = 4

Definition at line 37 of file MutableTexture.hpp.

Referenced by BARE2D::ResourceManager::createMutableTexture(), and setData().

◆ format

GLenum BARE2D::MutableTexture::format = GL_RGBA

Definition at line 36 of file MutableTexture.hpp.

Referenced by BARE2D::ResourceManager::createMutableTexture(), and setData().


The documentation for this class was generated from the following files: