Claire's Game Engine
Full C++ Engine using OpenGL
Loading...
Searching...
No Matches
Texture Class Reference

Texture is a wrapper for SDL and OpenGL texture loading, management, and activation. It abstracts differences between SDL and OpenGL renderers for texture creation and usage. More...

#include <Texture.h>

Public Member Functions

bool Load (IRenderer &pRenderer, const std::string &pFileName)
 Loads a texture file using the appropriate renderer (SDL or OpenGL).
 
void Unload ()
 Frees resources associated with the texture.
 
void SetActive (int slot) const
 Binds the texture as the currently active OpenGL texture. Note: This only applies to OpenGL renderers.
 
void UpdateInfo (int &pWidthOut, int &pHeightOut)
 Outputs the texture dimensions to the given references.
 
void SetTextureSize (int width, int height)
 Manually sets the size of the texture.
 
int GetWidth () const
 Gets the texture width.
 
int GetHeight () const
 Gets the texture height.
 
SDL_Texture * GetSDLTexture () const
 Gets the internal SDL texture pointer (only valid for SDL renderer).
 

Detailed Description

Texture is a wrapper for SDL and OpenGL texture loading, management, and activation. It abstracts differences between SDL and OpenGL renderers for texture creation and usage.

Member Function Documentation

◆ GetHeight()

int Texture::GetHeight ( ) const

Gets the texture height.

Returns
Height in pixels.

◆ GetSDLTexture()

SDL_Texture * Texture::GetSDLTexture ( ) const

Gets the internal SDL texture pointer (only valid for SDL renderer).

Returns
Pointer to SDL_Texture.

◆ GetWidth()

int Texture::GetWidth ( ) const

Gets the texture width.

Returns
Width in pixels.

◆ Load()

bool Texture::Load ( IRenderer & pRenderer,
const std::string & pFileName )

Loads a texture file using the appropriate renderer (SDL or OpenGL).

Parameters
pRendererReference to the renderer (determines backend).
pFileNamePath to the texture image file.
Returns
True if the texture was successfully loaded, false otherwise.

◆ SetActive()

void Texture::SetActive ( int slot) const

Binds the texture as the currently active OpenGL texture. Note: This only applies to OpenGL renderers.

◆ SetTextureSize()

void Texture::SetTextureSize ( int width,
int height )

Manually sets the size of the texture.

Parameters
widthNew width.
heightNew height.

◆ Unload()

void Texture::Unload ( )

Frees resources associated with the texture.

◆ UpdateInfo()

void Texture::UpdateInfo ( int & pWidthOut,
int & pHeightOut )

Outputs the texture dimensions to the given references.

Parameters
pWidthOutReceives texture width.
pHeightOutReceives texture height.

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