RtB/src/Texture.hpp

35 lines
1.2 KiB
C++

/* ================================================================
Texture
----------------
Texture.cpp/Texture.hpp provide the Texture class. This class is most akin to the Mesh object.
================================================================ */
#ifndef TEXTURE_HPP
#define TEXTURE_HPP
#include "common.hpp"
#include "RenderView.hpp"
#include <string>
class Texture {
public:
Texture(std::string name_, const char *buffer, size_t buffer_size);
Texture(std::string name_, RenderView *view);
Texture(std::string name_, SDL_Surface *surface);
~Texture();
enum Flags {
LOADED = (1 << 1),
BUILT = (1 << 2)
};
int loadSurface(SDL_Surface *surface);
int loadImg(const char *buffer, size_t buffer_size);
int unloadImg();
GLuint buildTexture();
int destroyTexture();
GLuint texture; //
int w, h; // width and height of this image
private:
std::string name;
unsigned int flags; // status flags
SDL_Surface *image; // the SDL_Surface that contains the data for the texture - this is populated on loadImg and should be destroyed by unloadImg whenever is convenient (usually after buildTexture)
};
#endif