Fix image size/stride error in test program

This commit is contained in:
shylie 2024-12-18 19:40:08 -05:00
parent 1a1f4e8b13
commit 7c0c02b9af
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ namespace
for (int i = 0; i < GRID_HEIGHT; i++) for (int i = 0; i < GRID_HEIGHT; i++)
{ {
glerminal_set(i + 1, i + 1, 0, 1); glerminal_set(i, i, 0, 1);
} }
glerminal_flush(); glerminal_flush();

View File

@ -8,7 +8,7 @@
namespace namespace
{ {
unsigned char pixels[(GRID_WIDTH * CELL_SCALE * 8) * (GRID_HEIGHT * CELL_SCALE * 8) * 3]; unsigned char pixels[(GRID_WIDTH * 8) * (GRID_HEIGHT * 8) * 3];
} }
void glerminal_test_save_image() void glerminal_test_save_image()
@ -21,5 +21,5 @@ void glerminal_test_save_image()
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
stbi_flip_vertically_on_write(true); stbi_flip_vertically_on_write(true);
stbi_write_png("image.png", GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, 3, pixels, GRID_WIDTH * CELL_SCALE * 8 * 3); stbi_write_png("image.png", GRID_WIDTH * 8, GRID_HEIGHT * 8, 3, pixels, GRID_WIDTH * 8 * 3);
} }