68 lines
1.1 KiB
C++
68 lines
1.1 KiB
C++
#ifndef __GLTEXTUR_H
|
|
#define __GLTEXTUR_H
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <SDL.h>
|
|
#include <SDL_image.h>
|
|
#include <SDL_opengl.h>
|
|
#include "sdlfuncs.h"
|
|
|
|
namespace segl {
|
|
|
|
class GLTexture {
|
|
private:
|
|
GLuint texint;
|
|
SDL_Surface *tex;
|
|
int width, height;
|
|
|
|
std::string filename; // wenn von datei geladen
|
|
|
|
// Parameter
|
|
GLint minfilter;
|
|
GLint magfilter;
|
|
GLint wraps;
|
|
GLint wrapt;
|
|
|
|
bool loaded;
|
|
bool texconverted;
|
|
bool keepsurface;
|
|
bool donotreload;
|
|
|
|
void init();
|
|
bool loadLocalSurface();
|
|
void convertLocalSurface();
|
|
|
|
static std::vector<GLTexture*> alltextures;
|
|
protected:
|
|
GLTexture(SDL_Surface*);
|
|
bool loadSurface(SDL_Surface*, bool = false);
|
|
public:
|
|
static void reloadAll();
|
|
|
|
GLTexture();
|
|
GLTexture(std::string, GLint=GL_LINEAR, GLint=GL_LINEAR, GLint=GL_REPEAT, GLint=GL_REPEAT);
|
|
~GLTexture();
|
|
|
|
//load
|
|
|
|
bool loadImage(std::string);
|
|
|
|
bool selectTexture();
|
|
void unloadTexture();
|
|
bool setParameter(GLint=0, GLint=0, GLint=0, GLint=0);
|
|
inline bool select() { return selectTexture(); }
|
|
|
|
int getW();
|
|
int getH();
|
|
|
|
|
|
|
|
bool isLoaded();
|
|
};
|
|
|
|
} // namespace segl
|
|
|
|
#endif
|