fix font texture switching

master
Alessandro Mauri 2 years ago
parent c9c58ca410
commit 988c36a50a
  1. 4
      text_rendering/main.c
  2. 1
      text_rendering/ren.c

@ -14,8 +14,10 @@ SDL_Window *win;
void draw(void)
{
static unsigned int frame = 0;
printf("frame: %d\n", frame++);
ren_clear();
if (ren_render_text(str, 0, 0, 100, 50, 20))
if (ren_render_text(str, 10, 10, 100, 50, 20))
printf("text: %s\n", ren_strerror());
ren_render_text("altro font", 200, 40, 300, 300, 40);
ren_render_box(100, 300, 50, 50, 0xffff0000);

@ -446,6 +446,7 @@ static int ren_draw_font_stack(int idx)
{
GL(glUseProgram(ren.font_prog))
GL(glBindBuffer(GL_ARRAY_BUFFER, ren.font_buffer))
GL(glBindTexture(GL_TEXTURE_RECTANGLE, ren.fonts[idx].texture))
GL(glViewport(0, 0, ren.width, ren.height))
// this has caused me some trouble, convert from image coordiates to viewport

Loading…
Cancel
Save