0.2 Draw axis

This commit is contained in:
PedroEdiaz
2024-09-05 14:48:51 +00:00
parent a2f49afbf4
commit 06e8e9074b
11 changed files with 213 additions and 53 deletions

37
src/texture.c Normal file
View 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;
}