YourGameLib
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
yourgame::gl::Texture Class Reference

#include <texture.h>

Public Member Functions

 Texture (Texture const &)=delete
 
Texture & operator= (Texture const &)=delete
 
 ~Texture ()
 
void bind () const
 
void unbindTarget () const
 
void updateData (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data, bool generateMipmap)
 
GLuint handle () const
 
GLenum getTarget () const
 
GLsizei getWidth () const
 
GLsizei getHeight () const
 
void insertCoords (std::string name, int x, int y, int width, int height, bool cwRot)
 
TextureCoords getCoords (std::string name) const
 returns texture coordinates of subtexture with name name
 
TextureCoords getFrameCoords (std::string sequenceName, int frame)
 returns texture coordinates of subtexture which is part of a sequence
 
int getNumFrames (std::string sequenceName) const
 returns the number of frames of a sequence
 
std::vector< std::string > getSequenceNames () const
 returns a list of the names of all sequences
 
TextureCoords getGridCoords (int gridWidth, int gridHeight, int index) const
 returns texture coordinates of grid subtexture
 

Static Public Member Functions

static Texture * make (GLenum target, GLenum unit, const std::vector< std::pair< GLenum, GLint > > &parameteri)
 

Constructor & Destructor Documentation

◆ Texture()

yourgame::gl::Texture::Texture ( Texture const &  )
delete

◆ ~Texture()

yourgame::gl::Texture::~Texture ( )

Member Function Documentation

◆ bind()

void yourgame::gl::Texture::bind ( ) const

◆ getCoords()

TextureCoords yourgame::gl::Texture::getCoords ( std::string  name) const

returns texture coordinates of subtexture with name name

Parameters
namename of subtexture to return

◆ getFrameCoords()

TextureCoords yourgame::gl::Texture::getFrameCoords ( std::string  sequenceName,
int  frame 
)

returns texture coordinates of subtexture which is part of a sequence

Parameters
sequenceNamename of the sequence
frameframe index. is always wrapped into valid range. may be negative

◆ getGridCoords()

TextureCoords yourgame::gl::Texture::getGridCoords ( int  gridWidth,
int  gridHeight,
int  index 
) const

returns texture coordinates of grid subtexture

Parameters
gridWidthnumber of grid columns
gridHeightnumber of grid rows
indexindex of the grid cell to return coordinates for, starting top-left with index 0

◆ getHeight()

GLsizei yourgame::gl::Texture::getHeight ( ) const
inline

◆ getNumFrames()

int yourgame::gl::Texture::getNumFrames ( std::string  sequenceName) const

returns the number of frames of a sequence

Parameters
sequenceNamename of the sequence

◆ getSequenceNames()

std::vector< std::string > yourgame::gl::Texture::getSequenceNames ( ) const

returns a list of the names of all sequences

◆ getTarget()

GLenum yourgame::gl::Texture::getTarget ( ) const
inline

◆ getWidth()

GLsizei yourgame::gl::Texture::getWidth ( ) const
inline

◆ handle()

GLuint yourgame::gl::Texture::handle ( ) const
inline

◆ insertCoords()

void yourgame::gl::Texture::insertCoords ( std::string  name,
int  x,
int  y,
int  width,
int  height,
bool  cwRot 
)

◆ make()

Texture * yourgame::gl::Texture::make ( GLenum  target,
GLenum  unit,
const std::vector< std::pair< GLenum, GLint > > &  parameteri 
)
static

◆ operator=()

Texture & yourgame::gl::Texture::operator= ( Texture const &  )
delete

◆ unbindTarget()

void yourgame::gl::Texture::unbindTarget ( ) const

◆ updateData()

void yourgame::gl::Texture::updateData ( GLenum  target,
GLint  level,
GLint  internalformat,
GLsizei  width,
GLsizei  height,
GLint  border,
GLenum  format,
GLenum  type,
const void *  data,
bool  generateMipmap 
)

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