1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-03 04:53:35 +00:00
lovr/src/graphics/texture.h

44 lines
1.2 KiB
C
Raw Normal View History

2016-11-19 09:28:01 +00:00
#include "glfw.h"
2016-11-08 11:14:33 +00:00
2016-11-14 01:28:22 +00:00
struct Buffer;
2016-11-08 11:14:33 +00:00
#ifndef LOVR_TEXTURE_TYPES
#define LOVR_TEXTURE_TYPES
2016-11-08 22:44:22 +00:00
typedef enum {
FILTER_NEAREST = GL_NEAREST,
FILTER_LINEAR = GL_LINEAR
} FilterMode;
typedef enum {
WRAP_CLAMP = GL_CLAMP_TO_EDGE,
WRAP_REPEAT = GL_REPEAT,
WRAP_MIRRORED_REPEAT = GL_MIRRORED_REPEAT,
WRAP_CLAMP_ZERO = GL_CLAMP_TO_BORDER
} WrapMode;
2016-11-08 11:14:33 +00:00
typedef struct {
GLuint id;
2016-11-14 01:28:22 +00:00
GLuint buffer;
2016-11-08 11:14:33 +00:00
int width;
int height;
2016-11-08 22:44:22 +00:00
FilterMode filterMin;
FilterMode filterMag;
WrapMode wrapHorizontal;
WrapMode wrapVertical;
2016-11-08 11:14:33 +00:00
} Texture;
#endif
Texture* lovrTextureCreate(void* data, int size);
2016-11-14 01:28:22 +00:00
Texture* lovrTextureCreateFromBuffer(struct Buffer* buffer);
2016-11-08 11:14:33 +00:00
void lovrTextureDestroy(Texture* texture);
2016-11-17 09:30:40 +00:00
void lovrTextureBind(Texture* texture);
void lovrTextureRefresh(Texture* texture);
2016-11-08 11:14:33 +00:00
int lovrTextureGetHeight(Texture* texture);
int lovrTextureGetWidth(Texture* texture);
2016-11-08 22:44:22 +00:00
void lovrTextureGetFilter(Texture* texture, FilterMode* min, FilterMode* mag);
void lovrTextureSetFilter(Texture* texture, FilterMode min, FilterMode mag);
void lovrTextureGetWrap(Texture* texture, WrapMode* horizontal, WrapMode* vertical);
void lovrTextureSetWrap(Texture* texture, WrapMode horizontal, WrapMode vertical);