Commit: 3e930e3140300c9bef7fbb94b7dacb7cdcbc2df7
Parent: 61602a6d403b230da75b6c6be9df7c79bca69eb3
Author: Randy Palamar
Date: Sat, 24 Aug 2024 12:45:10 -0600
manually pack pixels in render_glyph
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/font.c b/font.c
@@ -94,9 +94,12 @@ render_glyph(FontAtlas *fa, Arena a, u32 cp, Glyph *out_glyph, i32 *out_idx)
for (u32 i = 0; i < cg->g.size.h; i++) {
for (u32 j = 0; j < cg->g.size.w; j++) {
/* TODO: handled coloured glyphs */
- /* TODO: byte order of colour should be swapped to match GL_RBGA */
- Colour pixel = {.r = gs->bitmap.buffer[i * cg->g.size.w + j]};
- rgba_bitmap[i * MAX_FONT_SIZE + j] = pixel.rgba;
+ u32 pixel = 0;
+ if (0 /* COLOURED */) {
+ } else {
+ pixel = gs->bitmap.buffer[i * cg->g.size.w + j] << 24;
+ }
+ rgba_bitmap[i * MAX_FONT_SIZE + j] = pixel;
}
}
*out_glyph = cg->g;
diff --git a/main.c b/main.c
@@ -149,8 +149,6 @@ init_window(Term *t, Arena arena)
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
glGenTextures(1, &t->gl.glyph_tex);
glBindTexture(GL_TEXTURE_2D_ARRAY, t->gl.glyph_tex);
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -234,8 +232,8 @@ program_from_shader_text(s8 vertex, s8 fragment, Arena a)
static void
check_shaders(GLCtx *gl, Arena a)
{
- static char *fs_name[SHADER_LAST] = {"frag_render.glsl", "frag_post.glsl"};
- static char *vs_name[SHADER_LAST] = {"vert_render.glsl", "vert_post.glsl"};
+ static char *fs_name[SHADER_LAST] = {"/home/rnp/src/c/vtgl/frag_render.glsl", "/home/rnp/src/c/vtgl/frag_post.glsl"};
+ static char *vs_name[SHADER_LAST] = {"/home/rnp/src/c/vtgl/vert_render.glsl", "/home/rnp/src/c/vtgl/vert_post.glsl"};
static os_file_stats fs_stats[SHADER_LAST], vs_stats[SHADER_LAST];
static struct {
char *name;