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

Public Member Functions

 ComputeTexture (uint32_t width, uint32_t height, GLenum format=GL_RGBA32F)
 
 ComputeTexture (const ComputeTexture &copy)
 Copy constructor.
 
void BindTexture (bool force=false)
 Bind texture to OpenGL Generates and configures texture in GPU memory.
 
bool AttachToFrameBuffer (uint32_t framebuffer, GLenum attachmentType=GL_COLOR_ATTACHMENT0)
 Attach to an OpenGL framebuffer Generates and configures texture in GPU memory.
 
void * RetrieveData (GLenum format, size_t dataSize=sizeof(float), GLenum pixel=GL_FLOAT) const
 Retrieve pointer to the data from the texture.
 
- Public Member Functions inherited from StevEngine::Visuals::Texture
 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.
 

Public Attributes

const uint32_t width
 Width of the texture.
 
const uint32_t height
 Height of the texture.
 
const GLenum format
 OpenGL image storage format.
 

Additional Inherited Members

- Static Public Attributes inherited from StevEngine::Visuals::Texture
static const Texture empty = Texture()
 Empty texture singleton.
 
- Protected Member Functions inherited from StevEngine::Visuals::Texture
 Texture ()
 Create empty texture.
 
- Protected Attributes inherited from StevEngine::Visuals::Texture
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.
 

Constructor & Destructor Documentation

◆ ComputeTexture()

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

Copy constructor.

Parameters
copyTexture to copy

Member Function Documentation

◆ AttachToFrameBuffer()

bool StevEngine::Visuals::ComputeTexture::AttachToFrameBuffer ( uint32_t framebuffer,
GLenum attachmentType = GL_COLOR_ATTACHMENT0 )

Attach to an OpenGL framebuffer Generates and configures texture in GPU memory.

Parameters
framebufferOpenGL location of the framebuffer to attach to
Returns
true if attachment was succesful, false if not

◆ RetrieveData()

void * StevEngine::Visuals::ComputeTexture::RetrieveData ( GLenum format,
size_t dataSize = sizeof(float),
GLenum pixel = GL_FLOAT ) const

Retrieve pointer to the data from the texture.

Parameters
formatOpenGL pixel format for the returned data (
See also
https://docs.gl/gl4/glGetTexImage format parameter)
Parameters
dataSizeSize of the data for each pixel. For GL_RGB and GL_FLOAT it should be sizeof(float) * 3
pixelOpenGL pixel type for the returned data. (
See also
https://docs.gl/gl4/glGetTexImage type parameter)
Returns
true if attachment was succesful, false if not

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