PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
pk::GLTexture Class Reference

Class for creating textures usable with OpenGL from SDL. More...

#include <GLTexture.hpp>

Collaboration diagram for pk::GLTexture:
Collaboration graph

Public Member Functions

virtual ~GLTexture ()
 
 GLTexture (std::string path)
 
GLRect getTextureRect ()
 Get the GLTexture's texture rect with its bounds. More...
 
void setTextureRect (GLRect rect)
 Set the GLTexture's texture rect. More...
 
void setTextureCoordinateWrapParameters (GLint S, GLint T, GLint R)
 Set the texture coordinate wrap parameters for the texture. More...
 
void setTextureFilterParameters (GLint min, GLint mag)
 Set the texture filter parameters for the texture. More...
 
void load (std::string path)
 Load the GLTexture from an image file on the path. More...
 
void use ()
 Use the GLTexture by activating and binding it to your OpenGL program. More...
 
void disable ()
 Disables the GLTexture by unbinding the texture and calling glDisable(...). More...
 
void clear ()
 Clear all of the GLTexture data. More...
 

Private Member Functions

 GLTexture ()
 Default constructor - INACCESSIBLE! More...
 
void updateParameters ()
 Internally resets the texture parameters so that textures render as expected. More...
 

Private Attributes

SDL_Surface * m_surf
 An SDL surface useful for loading pixel data from a file. More...
 
int m_pixelFormat
 Stores the pixel format of the image that is loaded. More...
 
GLuint m_textureID
 The identifier for the texture. More...
 
GLRect m_rect
 The GLRect defining the bounds of the texture. More...
 
int m_bitDepth
 The bit depth of the texture. More...
 
GLint m_textureCoordinate_S
 The wrap parameter for the S coordinate of the texture. More...
 
GLint m_textureCoordinate_T
 The wrap parameter for the T coordinate of the texture. More...
 
GLint m_textureCoordinate_R
 The wrap parameter for the R coordinate of the texture. More...
 
GLint m_textureFilter_MIN
 The texture parameter for the minifying function. More...
 
GLint m_textureFilter_MAG
 The texture parameter for the magnifying function. More...
 

Detailed Description

Class for creating textures usable with OpenGL from SDL.

Constructor & Destructor Documentation

◆ GLTexture() [1/2]

pk::GLTexture::GLTexture ( )
inlineprivate

Default constructor - INACCESSIBLE!

◆ ~GLTexture()

virtual pk::GLTexture::~GLTexture ( )
virtual

◆ GLTexture() [2/2]

pk::GLTexture::GLTexture ( std::string  path)

Member Function Documentation

◆ clear()

pk::GLTexture::clear ( )

Clear all of the GLTexture data.

◆ disable()

pk::GLTexture::disable ( )

Disables the GLTexture by unbinding the texture and calling glDisable(...).

◆ getTextureRect()

GLRect pk::GLTexture::getTextureRect ( )
inline

Get the GLTexture's texture rect with its bounds.

Returns
GLRect - a GLRect corresponding to the internal dimensions of the GLTexture.

◆ load()

pk::GLTexture::load ( std::string  path)

Load the GLTexture from an image file on the path.

◆ setTextureCoordinateWrapParameters()

void pk::GLTexture::setTextureCoordinateWrapParameters ( GLint  S,
GLint  T,
GLint  R 
)

Set the texture coordinate wrap parameters for the texture.

Parameters
GLintS - the OpenGL wrap parameter for S texture coordinates.
GLintT - the OpenGL wrap parameter for T texture coordinates.
GLintR - the OpenGL wrap parameter for R texture coordinates.

◆ setTextureFilterParameters()

void pk::GLTexture::setTextureFilterParameters ( GLint  min,
GLint  mag 
)

Set the texture filter parameters for the texture.

Parameters
GLintmin - the OpenGL minifying function parameter for the texture.
GLintmag - the OpenGL magnifying function parameter for the texture.

◆ setTextureRect()

void pk::GLTexture::setTextureRect ( GLRect  rect)
inline

Set the GLTexture's texture rect.

Parameters
GLRectrect - a GLRect you wish to assign to the GLTexture.
Here is the call graph for this function:

◆ updateParameters()

void pk::GLTexture::updateParameters ( )
private

Internally resets the texture parameters so that textures render as expected.

◆ use()

pk::GLTexture::use ( )

Use the GLTexture by activating and binding it to your OpenGL program.

Member Data Documentation

◆ m_bitDepth

int pk::GLTexture::m_bitDepth
private

The bit depth of the texture.

◆ m_pixelFormat

int pk::GLTexture::m_pixelFormat
private

Stores the pixel format of the image that is loaded.

◆ m_rect

GLRect pk::GLTexture::m_rect
private

The GLRect defining the bounds of the texture.

◆ m_surf

SDL_Surface* pk::GLTexture::m_surf
private

An SDL surface useful for loading pixel data from a file.

◆ m_textureCoordinate_R

GLint pk::GLTexture::m_textureCoordinate_R
private

The wrap parameter for the R coordinate of the texture.

◆ m_textureCoordinate_S

GLint pk::GLTexture::m_textureCoordinate_S
private

The wrap parameter for the S coordinate of the texture.

◆ m_textureCoordinate_T

GLint pk::GLTexture::m_textureCoordinate_T
private

The wrap parameter for the T coordinate of the texture.

◆ m_textureFilter_MAG

GLint pk::GLTexture::m_textureFilter_MAG
private

The texture parameter for the magnifying function.

◆ m_textureFilter_MIN

GLint pk::GLTexture::m_textureFilter_MIN
private

The texture parameter for the minifying function.

◆ m_textureID

GLuint pk::GLTexture::m_textureID
private

The identifier for the texture.


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