A 3D game engine from scratch.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor gl stuff out of fonts

+21 -7
+2 -7
src/fonts.cpp
··· 103 103 character->advance = iv2(glyph->advance.x, glyph->advance.y); 104 104 } 105 105 106 - glActiveTexture(GL_TEXTURE0); 107 - glBindTexture(GL_TEXTURE_2D, texture_atlas->texture_name); 106 + mats::activate_font_texture(texture_atlas->texture_name); 108 107 109 108 for (uint32 c = 0; c < CHAR_MAX_CODEPOINT_TO_LOAD; c++) { 110 109 if ( ··· 127 126 continue; 128 127 } 129 128 130 - glTexSubImage2D(GL_TEXTURE_2D, 0, tex_coords.x, tex_coords.y, 131 - character->size.x, character->size.y, 132 - GL_RED, GL_UNSIGNED_BYTE, glyph->bitmap.buffer); 129 + mats::push_font_texture(tex_coords, character->size, glyph->bitmap.buffer); 133 130 134 131 character->tex_coords = tex_coords; 135 132 } 136 - 137 - glBindTexture(GL_TEXTURE_2D, 0); 138 133 }
+17
src/mats.cpp
··· 101 101 } 102 102 103 103 104 + void 105 + mats::activate_font_texture(u32 texture_name) 106 + { 107 + glActiveTexture(GL_TEXTURE0); 108 + glBindTexture(GL_TEXTURE_2D, texture_name); 109 + } 110 + 111 + 112 + void 113 + mats::push_font_texture(iv2 tex_coords, iv2 char_size, void const *data) 114 + { 115 + glTexSubImage2D(GL_TEXTURE_2D, 0, tex_coords.x, tex_coords.y, 116 + char_size.x, char_size.y, 117 + GL_RED, GL_UNSIGNED_BYTE, data); 118 + } 119 + 120 + 104 121 mats::Texture * 105 122 mats::init_texture( 106 123 Texture *texture,
+2
src/mats.hpp
··· 115 115 116 116 static char const * texture_type_to_string(TextureType texture_type); 117 117 static TextureType texture_type_from_string(char const *str); 118 + static void activate_font_texture(u32 texture_name); 119 + static void push_font_texture(iv2 tex_coords, iv2 char_size, void const *data); 118 120 static Texture * init_texture( 119 121 Texture *texture, 120 122 TextureType type,