39 lines
No EOL
1.1 KiB
C++
39 lines
No EOL
1.1 KiB
C++
#ifndef __TEXTURE_H__
|
|
#define __TEXTURE_H__
|
|
|
|
#include <GL/glew.h>
|
|
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_opengl.h>
|
|
#include <SDL2/SDL_video.h>
|
|
#include <string>
|
|
#include <SOIL/SOIL.h>
|
|
#include "shader.hpp"
|
|
|
|
struct textureSettings{
|
|
// how to handle pixels outside of texture (s=x, t=y)
|
|
GLenum s_wraping;
|
|
GLenum t_wraping;
|
|
// how to handle higher res pixels
|
|
GLenum mag_min;
|
|
GLenum mag_max;
|
|
};
|
|
|
|
class texture{
|
|
public:
|
|
GLuint ref;
|
|
textureSettings settings;
|
|
int width;
|
|
int height;
|
|
|
|
void genTexureGpu(GLfloat pixels[], int width, int height, GLenum texUnit = GL_TEXTURE0);
|
|
void genTexureGpu(GLfloat pixels[], int width, int height, textureSettings settings, GLenum texUnit = GL_TEXTURE0);
|
|
|
|
void loadFromPath(std::string path, GLenum texUnit = GL_TEXTURE0);
|
|
void loadFromPath(std::string path, textureSettings settings, GLenum texUnit = GL_TEXTURE0);
|
|
void setTexUniformLocation(std::string name, GLint id, shader *program);
|
|
};
|
|
|
|
textureSettings VELAGE_generateTextureSettings(GLenum s_wraping, GLenum t_wraping, GLenum mag_min, GLenum mag_max);
|
|
textureSettings VELAGE_generateTextureSettings(GLenum wraping, GLenum mag);
|
|
|
|
#endif |