0.2 Draw axis
This commit is contained in:
37
src/texture.c
Normal file
37
src/texture.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "main.h"
|
||||
#include <GL/gl.h>
|
||||
|
||||
#define TYPE GL_TEXTURE_2D_ARRAY
|
||||
|
||||
unsigned int config_texture( unsigned short type )
|
||||
{
|
||||
unsigned int texture;
|
||||
|
||||
glGenTextures( 1, &texture );
|
||||
glBindTexture( TYPE, texture );
|
||||
|
||||
{
|
||||
glTexParameteri( TYPE, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
glTexParameteri( TYPE, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
void use_texture( unsigned int texture )
|
||||
{
|
||||
return glBindTexture( TYPE, texture );
|
||||
}
|
||||
|
||||
void destroy_texture( unsigned int texture )
|
||||
{
|
||||
return glDeleteTextures( 1, &texture );
|
||||
}
|
||||
|
||||
unsigned int create_palette_texture( const unsigned char * colors )
|
||||
{
|
||||
unsigned int texture = config_texture( TYPE );
|
||||
glTexImage3D( TYPE, 0, GL_RGBA,
|
||||
1, 1, (*colors)/4, 0, GL_RGBA, GL_UNSIGNED_BYTE, colors+1);
|
||||
return texture;
|
||||
}
|
||||
Reference in New Issue
Block a user