Texture Loading Functions
These functions attempt to load the requested texture into memory, returning a pointer to an Image clas which holds the details of the texture loaded and provides functions to access the infomation.
LoadTexture
Function Prototypes
- Image * LoadTexture(std::string const &filename)
Loads a texture from the given filename. The GTL will use the file extension (everything after the final . (dot) in the file name) to select the loader. - Image * LoadTexture(std::string const &filename, FileTypes val)
Loads a texture from the given filename. The GTL will use the given FileType value to select the loader to use. - Image * LoadTexture(ReadFunc_t reader, SeekFunc_t seeker, FileTypes val)
Uses the given reading and seeking functions to load in a texture of a given type. The reading and seeking functions must work as specified on the key concepts page. - Image * LoadTexture(PHYSFS_File* file, FileTypes val)
Loads a texture from the given PhysFS file handle using the specified type to select the loader to use. - Image * LoadTexture(PHYSFS_File* file, std::string const &filename )
Loads a texture from the given PhysFS file handle using the filename provided to work out what type the image is to select the loader to use.
Return Value
- A pointer to a class which contains read online formation about the image, a pointer to the image data and functions to manipulate it
Possible Known Exceptions
Other Details / Notes
- If the image can not be loaded for any reason then the Image class pointed to will have a FORMAT_NONE image type
- If the requested image is already open else where loading can fail and a pointer to a nulled Image object is return
- When the FileType is specified the loader doesnt try to to second guess the user, it assumes you know what you are doing.
- When using the PhysFS support it is upto the end user to link the correct PhysFS lib files into the project. Without doing to the linking of the final exe will fail.