- glGenTextures( 1, &ui_glyph_texture );
- glBindTexture( GL_TEXTURE_2D, ui_glyph_texture );
-
- glTexImage2D( GL_TEXTURE_2D, 0, GL_R8, 72, 72, 0, GL_RED, GL_UNSIGNED_BYTE, image );
-
- vg_tex2d_clamp();
- vg_tex2d_nearest();
-
- free( image );
-}
-
-static void ui_default_init(void)
-{
- ui_glyphs_load( (u32[]){
- #include "fonts/weiholmir.h"
- });
-
- SHADER_INIT( shader_ui );
-
- // Generate the buffer we are gonna be drawing to
- glGenVertexArrays(1, &ui_vao);
- glGenBuffers( 1, &ui_vbo );
- glGenBuffers( 1, &ui_ebo );
- glBindVertexArray( ui_vao );
-
- glBindBuffer( GL_ARRAY_BUFFER, ui_vbo );
-
- glBufferData( GL_ARRAY_BUFFER, UI_BUFFER_SIZE * sizeof( struct ui_vert ), NULL, GL_DYNAMIC_DRAW );
- glBindVertexArray( ui_vao );
-
- glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, ui_ebo );
- glBufferData( GL_ELEMENT_ARRAY_BUFFER, UI_INDEX_SIZE * sizeof( u16 ), NULL, GL_DYNAMIC_DRAW );
-
- // XY
- glVertexAttribPointer( 0, 2, GL_UNSIGNED_SHORT, GL_FALSE, sizeof( struct ui_vert ), (void *)offsetof( struct ui_vert, co ) );
- glEnableVertexAttribArray( 0 );
-
- // UV
- glVertexAttribPointer( 1, 2, GL_UNSIGNED_BYTE, GL_FALSE, sizeof( struct ui_vert ), (void *)offsetof( struct ui_vert, uv ) );
- glEnableVertexAttribArray( 1 );
-
- // COLOUR
- glVertexAttribPointer( 2, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof( struct ui_vert ), (void *)offsetof( struct ui_vert, colour ) );
- glEnableVertexAttribArray( 2 );