StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
StevEngine::Visuals::Texture Class Reference

OpenGL texture wrapper. More...

#include <visuals/Texture.hpp>

Inheritance diagram for StevEngine::Visuals::Texture:
StevEngine::Visuals::ComputeTexture

Public Member Functions

 Texture (Resources::Resource file)
 Load texture from resource.
 
 Texture (const Texture &copy)
 Copy constructor.
 
void operator= (const Texture &copy)
 Assignment operator.
 
 ~Texture ()
 Clean up texture resources.
 
void BindTexture (bool force=false)
 Bind texture to OpenGL Generates and configures texture in GPU memory.
 
void FreeTexture ()
 Free texture from OpenGL Releases texture from GPU memory.
 
bool IsBound () const
 Check if texture is bound to OpenGL.
 
GLuint GetGLLocation () const
 Get OpenGL texture ID.
 
std::string GetPath () const
 Get texture file path.
 

Static Public Attributes

static const Texture empty = Texture()
 Empty texture singleton.
 

Protected Member Functions

 Texture ()
 Create empty texture.
 

Protected Attributes

std::string path
 Path to texture file.
 
SDL_Surface * surface
 SDL surface containing image data.
 
GLuint GLLocation
 OpenGL texture ID.
 
bool bound
 Whether texture is bound to OpenGL.
 

Detailed Description

OpenGL texture wrapper.

Manages loading, binding and cleanup of OpenGL textures. Supports loading from image files and provides texture state management.

Constructor & Destructor Documentation

◆ Texture() [1/2]

StevEngine::Visuals::Texture::Texture ( Resources::Resource file)

Load texture from resource.

Parameters
fileResource containing image data

◆ Texture() [2/2]

StevEngine::Visuals::Texture::Texture ( const Texture & copy)

Copy constructor.

Parameters
copyTexture to copy

Member Function Documentation

◆ GetGLLocation()

GLuint StevEngine::Visuals::Texture::GetGLLocation ( ) const
inline

Get OpenGL texture ID.

Returns
OpenGL texture location

◆ GetPath()

std::string StevEngine::Visuals::Texture::GetPath ( ) const
inline

Get texture file path.

Returns
Path to source texture file

◆ IsBound()

bool StevEngine::Visuals::Texture::IsBound ( ) const
inline

Check if texture is bound to OpenGL.

Returns
True if texture is in GPU memory

◆ operator=()

void StevEngine::Visuals::Texture::operator= ( const Texture & copy)

Assignment operator.

Parameters
copyTexture to copy from

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