galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::graphics::Texture Class Referenceabstract

OpenGL 2D Texture. More...

#include <Texture.hpp>

+ Inheritance diagram for galaxy::graphics::Texture:
+ Collaboration diagram for galaxy::graphics::Texture:

Public Member Functions

 Texture (Texture &&)
 Move constructor.
 
Textureoperator= (Texture &&)
 Move assignment operator.
 
virtual ~Texture ()
 Destructor.
 
TextureView make_view (const unsigned int minlevel=0, const unsigned int numlevels=1, const unsigned int minlayer=0, const unsigned int numlayers=1)
 Create a texture view.
 
virtual void bind ()=0
 Activate context.
 
virtual void unbind ()=0
 Deactivate context.
 
void mode (const TextureMode mode)
 Set texture mode.
 
TextureMode mode () const
 Get texture mode.
 
void filter (const TextureFilter filter)
 Set filter when texture is (up/down)scaled in OpenGL.
 
TextureFilter filter () const
 Get texture filter.
 
void anisotropy (const int level)
 Set ansiotropic filtering level.
 
int anisotropy () const
 Get current anisotropy level.
 
float width () const
 Get texture width.
 
float height () const
 Get texture height.
 
unsigned int id () const
 Gets opengl handle.
 

Protected Member Functions

 Texture ()
 Constructor.
 

Protected Attributes

unsigned int m_id
 OpenGL id.
 
int m_width
 Cached width.
 
int m_height
 Cached height.
 
TextureMode m_mode
 Mode.
 
TextureFilter m_filter
 Filter.
 
int m_anisotropy
 Ansiotrophy level.
 

Private Member Functions

 Texture (const Texture &)=delete
 Copy constructor.
 
Textureoperator= (const Texture &)=delete
 Copy assignment operator.
 

Detailed Description

OpenGL 2D Texture.

Definition at line 25 of file Texture.hpp.

Constructor & Destructor Documentation

◆ Texture() [1/3]

galaxy::graphics::Texture::Texture ( Texture && t)

Move constructor.

Definition at line 32 of file Texture.cpp.

◆ ~Texture()

galaxy::graphics::Texture::~Texture ( )
virtual

Destructor.

Definition at line 71 of file Texture.cpp.

◆ Texture() [2/3]

galaxy::graphics::Texture::Texture ( )
protected

Constructor.

Definition at line 22 of file Texture.cpp.

◆ Texture() [3/3]

galaxy::graphics::Texture::Texture ( const Texture & )
privatedelete

Copy constructor.

Member Function Documentation

◆ operator=() [1/2]

Texture & galaxy::graphics::Texture::operator= ( Texture && t)

Move assignment operator.

Definition at line 49 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ make_view()

TextureView galaxy::graphics::Texture::make_view ( const unsigned int minlevel = 0,
const unsigned int numlevels = 1,
const unsigned int minlayer = 0,
const unsigned int numlayers = 1 )
nodiscard

Create a texture view.

Parameters
parentTexture id of which to create a view from.
minlevelMipmap level.
numlevelsNumber of mipmaps to include.
minlayerSpecifies the index of the first layer to include in the view.
numlayersSpecifies the number of layers to include in the view.
Returns
OpenGL texture view of this texture.

Definition at line 79 of file Texture.cpp.

◆ bind()

virtual void galaxy::graphics::Texture::bind ( )
pure virtual

Activate context.

Implemented in galaxy::graphics::Texture2D, galaxy::graphics::TextureArray, and galaxy::graphics::TextureView.

+ Here is the caller graph for this function:

◆ unbind()

virtual void galaxy::graphics::Texture::unbind ( )
pure virtual

◆ mode() [1/2]

void galaxy::graphics::Texture::mode ( const TextureMode mode)

Set texture mode.

Parameters
modeI.e. GL_REPEAT, GL_CLAMP_TO_EDGE, etc.

Definition at line 91 of file Texture.cpp.

+ Here is the call graph for this function:

◆ mode() [2/2]

TextureMode galaxy::graphics::Texture::mode ( ) const
nodiscard

Get texture mode.

Returns
Enum.

Definition at line 97 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ filter() [1/2]

void galaxy::graphics::Texture::filter ( const TextureFilter filter)

Set filter when texture is (up/down)scaled in OpenGL.

Parameters
filterFiltering to use for min/mag.

Definition at line 102 of file Texture.cpp.

+ Here is the call graph for this function:

◆ filter() [2/2]

TextureFilter galaxy::graphics::Texture::filter ( ) const
nodiscard

Get texture filter.

Returns
Enum.

Definition at line 120 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ anisotropy() [1/2]

void galaxy::graphics::Texture::anisotropy ( const int level)

Set ansiotropic filtering level.

Parameters
level0 to 16. Must be 0/2/4/8/16.

Definition at line 125 of file Texture.cpp.

◆ anisotropy() [2/2]

int galaxy::graphics::Texture::anisotropy ( ) const
nodiscard

Get current anisotropy level.

Returns
Integer.

Definition at line 152 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ width()

float galaxy::graphics::Texture::width ( ) const
nodiscard

Get texture width.

Is cached for performance.

Returns
Width as float.

Definition at line 157 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ height()

float galaxy::graphics::Texture::height ( ) const
nodiscard

Get texture height.

Is cached for performance.

Returns
Height as float.

Definition at line 162 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ id()

unsigned int galaxy::graphics::Texture::id ( ) const
nodiscard

Gets opengl handle.

Returns
Unsigned int.

Definition at line 167 of file Texture.cpp.

+ Here is the caller graph for this function:

◆ operator=() [2/2]

Texture & galaxy::graphics::Texture::operator= ( const Texture & )
privatedelete

Copy assignment operator.

Member Data Documentation

◆ m_id

unsigned int galaxy::graphics::Texture::m_id
protected

OpenGL id.

Definition at line 161 of file Texture.hpp.

◆ m_width

int galaxy::graphics::Texture::m_width
protected

Cached width.

Definition at line 166 of file Texture.hpp.

◆ m_height

int galaxy::graphics::Texture::m_height
protected

Cached height.

Definition at line 171 of file Texture.hpp.

◆ m_mode

TextureMode galaxy::graphics::Texture::m_mode
protected

Mode.

Definition at line 176 of file Texture.hpp.

◆ m_filter

TextureFilter galaxy::graphics::Texture::m_filter
protected

Filter.

Definition at line 181 of file Texture.hpp.

◆ m_anisotropy

int galaxy::graphics::Texture::m_anisotropy
protected

Ansiotrophy level.

Definition at line 186 of file Texture.hpp.


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