Waterflow
Visualize water in terrain
|
Stores an image as an SDL_Surface, and binds it as a usable texture. More...
#include <sdlTexture.h>
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. |
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.
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().
tPath | path to image file. |
gTexID | texture ID. Can be initialized as 0 if ut's not pre-initialized ahead of time. |
Definition at line 8 of file sdlTexture.cpp.
GLuint sdlTexture::getTexID | ( | ) |
Getter for the texture ID bound to the loaded image. Will be -1 when image couldn't be loaded.
Definition at line 48 of file sdlTexture.cpp.