math functions
This commit is contained in:
parent
0cef6840af
commit
9d11089a75
15 changed files with 265 additions and 47 deletions
20
engine/src/gl_texture.c
Normal file
20
engine/src/gl_texture.c
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue