Waterflow
Visualize water in terrain
sdlTexture Class Reference

Stores an image as an SDL_Surface, and binds it as a usable texture. More...

#include <sdlTexture.h>

List of all members.

Public Member Functions

 sdlTexture (std::string tPath, GLuint gTexID)
 Reads the image file and binds it to a texture ID.
GLuint getTexID ()
 Getter for the texture ID bound to the loaded image. Will be -1 when image couldn't be loaded.

Private Attributes

GLuint gTextureID
 Texture ID that the image is bound to.
SDL_Surface * Surface
 SDL_Surface used to store the image data.
std::string texPath
 Path to the image file.

Detailed Description

Stores an image as an SDL_Surface, and binds it as a usable texture.

Use the sdlTexture class to import image files into the project. It is designed to be compatible with SDL2, and provides a texture ID that can be used as (for instance) a terrain texture. Supported file types are: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV. If there is an error loading the image file, gTextureID will be set to -1.

Definition at line 19 of file sdlTexture.h.


Constructor & Destructor Documentation

sdlTexture::sdlTexture ( std::string  tPath,
GLuint  gTexID 
)

Reads the image file and binds it to a texture ID.

tPath must be a valid path to an image file. After initialization, the texture ID can then be accessed using getTexID().

Parameters:
tPathpath to image file.
gTexIDtexture ID. Can be initialized as 0 if ut's not pre-initialized ahead of time.
See also:
getTexID()
Todo:
Currently only designed to work on Windows.

Definition at line 8 of file sdlTexture.cpp.


Member Function Documentation

Getter for the texture ID bound to the loaded image. Will be -1 when image couldn't be loaded.

Returns:
texture ID bound to the image.

Definition at line 48 of file sdlTexture.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations