40 lines
912 B
C++
40 lines
912 B
C++
#ifndef TEXTURE_H
|
|
#define TEXTURE_H
|
|
|
|
#include <glew/glew.h>
|
|
#include <string>
|
|
|
|
class Image;
|
|
|
|
class Texture
|
|
{
|
|
private:
|
|
GLuint texId;
|
|
GLenum target;
|
|
|
|
void initPixels(Image* myImage, GLenum textureSlot);
|
|
public:
|
|
// creates a 2D texture from perlin noise
|
|
Texture();
|
|
// creates an empty 2D texture
|
|
Texture(GLenum format = GL_RGBA,
|
|
GLenum internal_format = GL_RGBA,
|
|
int width = 512,
|
|
int height = 512,
|
|
GLenum dataType = GL_UNSIGNED_BYTE,
|
|
GLenum texTarget = GL_TEXTURE_2D);
|
|
// creates a standard texture from an image
|
|
Texture(Image* myImage);
|
|
// creates a cubeMap from 6 images
|
|
Texture(Image* myCubemapImages[6]);
|
|
|
|
~Texture();
|
|
void bind(int slot);
|
|
GLuint getId() {return texId;}
|
|
GLenum getTarget() {return target;}
|
|
void setWrap(GLint wrap);
|
|
void setFiltering(GLint filter);
|
|
};
|
|
|
|
#endif // TEXTURE_H
|