aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-15 23:52:21 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-15 23:52:21 +0100
commit6042e1843023e1f4e0f4c60da8458703b3bc58cf (patch)
treeef32c36ab78fb4d292ffd96681b4beee28a27b63 /src/graphics
parentcac754b9f5d4695bd6416ac94fcab22423a854f9 (diff)
Revert text offset y fix because it breaks quickmedia. Revert vertex draw texture coordinate reset because it breaks quickmedia
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/font.c2
-rw-r--r--src/graphics/text.c2
-rw-r--r--src/graphics/vertex.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/src/graphics/font.c b/src/graphics/font.c
index 9a99f22..8c55044 100644
--- a/src/graphics/font.c
+++ b/src/graphics/font.c
@@ -227,7 +227,7 @@ int mgl_font_get_glyph(mgl_font *self, uint32_t codepoint, mgl_font_glyph *glyph
render_offset.y = self->font_atlas.pointer_position.y;
mgl_font_glyph new_glyph;
- new_glyph.position = (mgl_vec2i){ xoff/GLYPH_UPSAMPLE, self->ascent + yoff/GLYPH_UPSAMPLE };
+ new_glyph.position = (mgl_vec2i){ xoff/GLYPH_UPSAMPLE, yoff/GLYPH_UPSAMPLE };
new_glyph.size = (mgl_vec2i){ width/GLYPH_UPSAMPLE, height/GLYPH_UPSAMPLE };
new_glyph.texture_position = (mgl_vec2i){ render_offset.x, render_offset.y };
new_glyph.texture_size = (mgl_vec2i){ width, height };
diff --git a/src/graphics/text.c b/src/graphics/text.c
index 92c578c..61c2919 100644
--- a/src/graphics/text.c
+++ b/src/graphics/text.c
@@ -217,7 +217,7 @@ void mgl_text_draw(mgl_context *context, mgl_text *text) {
mgl_text_get_bounds(text);
TextDrawUserdata text_draw_userdata;
- text_draw_userdata.position = (mgl_vec2f){ text->position.x, text->position.y };
+ text_draw_userdata.position = (mgl_vec2f){ text->position.x, text->position.y + text->font->character_size };
text_draw_userdata.text = text;
text_draw_userdata.context = context;
text_draw_userdata.prev_codepoint = 0;
diff --git a/src/graphics/vertex.c b/src/graphics/vertex.c
index 8e9b5b9..b45f38c 100644
--- a/src/graphics/vertex.c
+++ b/src/graphics/vertex.c
@@ -8,6 +8,10 @@ void mgl_vertices_draw(mgl_context *context, const mgl_vertex *vertices, size_t
context->gl.glPushMatrix();
context->gl.glTranslatef(position.x, position.y, 0.0f);
+ context->gl.glMatrixMode(GL_TEXTURE);
+ context->gl.glLoadIdentity();
+ context->gl.glMatrixMode(GL_MODELVIEW);
+
context->gl.glVertexPointer(2, GL_FLOAT, sizeof(mgl_vertex), (void*)&vertices[0].position);
context->gl.glTexCoordPointer(2, GL_FLOAT, sizeof(mgl_vertex), (void*)&vertices[0].texcoords);
context->gl.glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(mgl_vertex), (void*)&vertices[0].color);