20 lines
688 B
C
20 lines
688 B
C
#include <GearBox/GL.h>
|
|
|
|
int GBGLTexturePrepare(GBGL gl, GLuint* texture, unsigned char* rgba, int width, int height) {
|
|
glGenTextures(1, texture);
|
|
glBindTexture(GL_TEXTURE_2D, *texture);
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgba);
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
}
|
|
|
|
void GBGLTextureEnable(GBGL gl, GLuint texture) {
|
|
glBindTexture(GL_TEXTURE_2D, texture);
|
|
glEnable(GL_TEXTURE_2D);
|
|
}
|
|
|
|
void GBGLTextureDisable(GBGL gl, GLuint texture) {
|
|
glDisable(GL_TEXTURE_2D);
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
}
|