Rework testing code

This commit is contained in:
Shylie
2024-05-27 13:07:50 -04:00
parent 12f7d22009
commit 65c6de85ba
3 changed files with 34 additions and 7 deletions

View File

@@ -13,8 +13,12 @@ namespace
void glerminal_test_save_image()
{
glReadBuffer(GL_LEFT);
glReadPixels(0, 0, GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, GL_RGB, GL_UNSIGNED_BYTE, pixels);
// -- DIRTY HACK --
//
// GL_TEXTURE_2D is not rebound after setting up screen framebuffer
// This code will break if this behavior changes
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
stbi_flip_vertically_on_write(true);
stbi_write_png("image.png", GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, 3, pixels, 1280 * 3);