mirror of
https://git.shylie.info/shylie/glerminal.git
synced 2025-07-18 00:31:08 +00:00
Compare commits
3 Commits
1bfbab7a96
...
fb3eeb6ec9
Author | SHA1 | Date | |
---|---|---|---|
fb3eeb6ec9 | |||
263cf68ca2 | |||
b8e616c8d6 |
@ -20,7 +20,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
lfs: true
|
lfs: true
|
||||||
- run: cd prev && git checkout 0a9d211942
|
- run: cd prev && git checkout 263cf68ca2
|
||||||
- name: Build current
|
- name: Build current
|
||||||
run: cmake -S curr -B curr/build -DGLERMINAL_TEST=ON && cmake --build curr/build
|
run: cmake -S curr -B curr/build -DGLERMINAL_TEST=ON && cmake --build curr/build
|
||||||
- name: Build previous
|
- name: Build previous
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
build/
|
build/
|
||||||
cmake-build-*/
|
cmake-build-*/
|
||||||
.idea/
|
.idea/
|
||||||
|
.cache/
|
||||||
|
@ -59,10 +59,10 @@ target_compile_definitions(glerminal
|
|||||||
GLERMINAL_VERSION_PATCH=${PROJECT_VERSION_PATCH}
|
GLERMINAL_VERSION_PATCH=${PROJECT_VERSION_PATCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (PROJECT_IS_TOP_LEVEL)
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
add_subdirectory(examples examples)
|
add_subdirectory(examples examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GLERMINAL_TEST)
|
if(GLERMINAL_TEST)
|
||||||
add_subdirectory(tests tests)
|
add_subdirectory(tests tests)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,372 +0,0 @@
|
|||||||
#include <glerminal.h>
|
|
||||||
#define GLFW_INCLUDE_NONE
|
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include <lualib.h>
|
|
||||||
#include <lauxlib.h>
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define WINDOWS_LEAN_AND_MEAN
|
|
||||||
#include <Windows.h>
|
|
||||||
#define CHANGE_WORKING_DIRECTORY(path) !(SetCurrentDirectory(path))
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#define CHANGE_WORKING_DIRECTORY(path) chdir(path)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
int lglerminal_quit(lua_State* L)
|
|
||||||
{
|
|
||||||
glerminal_quit();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_flush(lua_State* L)
|
|
||||||
{
|
|
||||||
glerminal_flush();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_set(lua_State* L)
|
|
||||||
{
|
|
||||||
const int x = luaL_checkinteger(L, 1);
|
|
||||||
const int y = luaL_checkinteger(L, 2);
|
|
||||||
const int layer = luaL_checkinteger(L, 3) - 1;
|
|
||||||
const unsigned short sprite = luaL_checkinteger(L, 4) - 1;
|
|
||||||
glerminal_set(x, y, layer, sprite);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_get(lua_State* L)
|
|
||||||
{
|
|
||||||
const int x = luaL_checkinteger(L, 1);
|
|
||||||
const int y = luaL_checkinteger(L, 2);
|
|
||||||
const int layer = luaL_checkinteger(L, 3) - 1;
|
|
||||||
lua_pushnumber(L, glerminal_get(x, y, layer) + 1);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_offset(lua_State* L)
|
|
||||||
{
|
|
||||||
const int x = luaL_checkinteger(L, 1);
|
|
||||||
const int y = luaL_checkinteger(L, 2);
|
|
||||||
const int layer = luaL_checkinteger(L, 3) - 1;
|
|
||||||
const float ox = luaL_checknumber(L, 4);
|
|
||||||
const float oy = luaL_checknumber(L, 5);
|
|
||||||
glerminal_offset(x, y, layer, ox, oy);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_layer_color(lua_State* L)
|
|
||||||
{
|
|
||||||
const int x = luaL_checkinteger(L, 1);
|
|
||||||
const int y = luaL_checkinteger(L, 2);
|
|
||||||
const int layer = luaL_checkinteger(L, 3) - 1;
|
|
||||||
const float r = luaL_checknumber(L, 4);
|
|
||||||
const float g = luaL_checknumber(L, 5);
|
|
||||||
const float b = luaL_checknumber(L, 6);
|
|
||||||
const float a = luaL_optnumber(L, 7, 1.0f);
|
|
||||||
|
|
||||||
int ri = 255 * r;
|
|
||||||
int gi = 255 * g;
|
|
||||||
int bi = 255 * b;
|
|
||||||
int ai = 255 * a;
|
|
||||||
|
|
||||||
if (ri > 255) { ri = 255; }
|
|
||||||
if (ri < 0) { ri = 0; }
|
|
||||||
|
|
||||||
if (gi > 255) { gi = 255; }
|
|
||||||
if (gi < 0) { gi = 0; }
|
|
||||||
|
|
||||||
if (bi > 255) { bi = 255; }
|
|
||||||
if (bi < 0) { bi = 0; }
|
|
||||||
|
|
||||||
if (ai > 255) { ai = 255; }
|
|
||||||
if (ai < 0) { ai = 0; }
|
|
||||||
|
|
||||||
const unsigned int color = ri | (gi << 8) | (bi << 16) | (ai << 24);
|
|
||||||
|
|
||||||
glerminal_color(x, y, layer, color);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_layer_scale(lua_State* L)
|
|
||||||
{
|
|
||||||
const int x = luaL_checkinteger(L, 1);
|
|
||||||
const int y = luaL_checkinteger(L, 2);
|
|
||||||
const int layer = luaL_checkinteger(L, 3) - 1;
|
|
||||||
const float scale = luaL_checknumber(L, 4);
|
|
||||||
glerminal_scale(x, y, layer, scale);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_load_sprites_file(lua_State* L)
|
|
||||||
{
|
|
||||||
const char* path = luaL_checkstring(L, 1);
|
|
||||||
lua_pushboolean(L, glerminal_load_sprites_file(path));
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lglerminal_play_sound(lua_State* L)
|
|
||||||
{
|
|
||||||
const char* name = luaL_checkstring(L, 1);
|
|
||||||
glerminal_sound(name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const luaL_Reg lglerminal_methods[] =
|
|
||||||
{
|
|
||||||
{ "quit", lglerminal_quit },
|
|
||||||
{ "flush", lglerminal_flush },
|
|
||||||
{ "set", lglerminal_set },
|
|
||||||
{ "get", lglerminal_get },
|
|
||||||
{ "offset", lglerminal_offset },
|
|
||||||
{ "tint", lglerminal_layer_color },
|
|
||||||
{ "scale", lglerminal_layer_scale },
|
|
||||||
{ "sprites", lglerminal_load_sprites_file },
|
|
||||||
{ "sound", lglerminal_play_sound },
|
|
||||||
{ nullptr, nullptr }
|
|
||||||
};
|
|
||||||
|
|
||||||
int message_handler(lua_State* L)
|
|
||||||
{
|
|
||||||
luaL_traceback(L, L, lua_tostring(L, -1), 1);
|
|
||||||
lua_remove(L, -2);
|
|
||||||
|
|
||||||
glerminal_quit();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_State* L;
|
|
||||||
|
|
||||||
void init()
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "init");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
if (lua_pcall(L, 0, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mainloop(double dt)
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "main");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_pushnumber(L, dt);
|
|
||||||
if (lua_pcall(L, 1, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void keypressed(int key)
|
|
||||||
{
|
|
||||||
const char* const name = glfwGetKeyName(key, 0);
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "keypress");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_pushstring(L, name);
|
|
||||||
if (lua_pcall(L, 1, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyrelease(int key)
|
|
||||||
{
|
|
||||||
const char* const name = glfwGetKeyName(key, 0);
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "keyrelease");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_pushstring(L, name);
|
|
||||||
if (lua_pcall(L, 1, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mousemove(double x, double y)
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "mousemove");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_pushnumber(L, x);
|
|
||||||
lua_pushnumber(L, y);
|
|
||||||
if (lua_pcall(L, 2, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mousepress(int button, double x, double y)
|
|
||||||
{
|
|
||||||
const char* button_name = nullptr;
|
|
||||||
switch (button)
|
|
||||||
{
|
|
||||||
case GLFW_MOUSE_BUTTON_LEFT:
|
|
||||||
button_name = "left";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_MOUSE_BUTTON_RIGHT:
|
|
||||||
button_name = "right";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_MOUSE_BUTTON_MIDDLE:
|
|
||||||
button_name = "middle";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button_name)
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "mousepress");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_pushstring(L, button_name);
|
|
||||||
lua_pushnumber(L, x);
|
|
||||||
lua_pushnumber(L, y);
|
|
||||||
if (lua_pcall(L, 3, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouserelease(int button, double x, double y)
|
|
||||||
{
|
|
||||||
const char* button_name = nullptr;
|
|
||||||
switch (button)
|
|
||||||
{
|
|
||||||
case GLFW_MOUSE_BUTTON_LEFT:
|
|
||||||
button_name = "left";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_MOUSE_BUTTON_RIGHT:
|
|
||||||
button_name = "right";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_MOUSE_BUTTON_MIDDLE:
|
|
||||||
button_name = "middle";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button_name)
|
|
||||||
{
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
lua_getglobal(L, "glerminal");
|
|
||||||
lua_getfield(L, -1, "mouserelease");
|
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_pushstring(L, button_name);
|
|
||||||
lua_pushnumber(L, x);
|
|
||||||
lua_pushnumber(L, y);
|
|
||||||
if (lua_pcall(L, 3, 0, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
std::cout << lua_tostring(L, -1) << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
lua_remove(L, handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
if (argc == 1)
|
|
||||||
{
|
|
||||||
std::cout << "Usage: " << argv[0] << " <project directory>" << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CHANGE_WORKING_DIRECTORY(argv[1]))
|
|
||||||
{
|
|
||||||
std::cout << "Failed to find project directory" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
L = luaL_newstate();
|
|
||||||
luaL_openlibs(L);
|
|
||||||
|
|
||||||
luaL_newlib(L, lglerminal_methods);
|
|
||||||
lua_setglobal(L, "glerminal");
|
|
||||||
|
|
||||||
lua_pushcfunction(L, message_handler);
|
|
||||||
const int handler = lua_gettop(L);
|
|
||||||
if (luaL_loadfile(L, "main.lua") != LUA_OK)
|
|
||||||
{
|
|
||||||
const char* str = lua_tostring(L, -1);
|
|
||||||
std::cout << str << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
else if (lua_pcall(L, 0, LUA_MULTRET, handler) != LUA_OK)
|
|
||||||
{
|
|
||||||
const char* str = lua_tostring(L, -1);
|
|
||||||
std::cout << str << std::endl;
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glerminal_init_params params;
|
|
||||||
params.init = init;
|
|
||||||
params.main = mainloop;
|
|
||||||
params.keypress = keypressed;
|
|
||||||
params.keyrelease = keyrelease;
|
|
||||||
params.moved = mousemove;
|
|
||||||
params.mousepress = mousepress;
|
|
||||||
params.mouserelease = mouserelease;
|
|
||||||
glerminal_run(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_close(L);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -288,9 +288,9 @@ namespace glerminal
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||||
|
|
||||||
glBlitNamedFramebuffer(m_screen_framebuffer, 0, 0, 0, GRID_WIDTH * CELL_SIZE, GRID_HEIGHT * CELL_SIZE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glfwSwapBuffers(m_window);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glBlitNamedFramebuffer(m_screen_framebuffer, 0, 0, 0, GRID_WIDTH * CELL_SIZE, GRID_HEIGHT * CELL_SIZE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
glBlitNamedFramebuffer(m_screen_framebuffer, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
glfwSwapBuffers(m_window);
|
glfwSwapBuffers(m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ namespace glerminal
|
|||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glViewport(0, 0, GRID_WIDTH * CELL_SIZE, GRID_HEIGHT * CELL_SIZE);
|
glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
|
||||||
// -- setup vertex data --
|
// -- setup vertex data --
|
||||||
// create vertex buffer object
|
// create vertex buffer object
|
||||||
@ -756,7 +756,7 @@ namespace glerminal
|
|||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 0);
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 0);
|
||||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 0);
|
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 0);
|
||||||
|
|
||||||
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, GRID_WIDTH * CELL_SIZE, GRID_HEIGHT * CELL_SIZE, LAYER_COUNT);
|
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, SCREEN_WIDTH, SCREEN_HEIGHT, LAYER_COUNT);
|
||||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_framebuffer_backing_texture, 0);
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_framebuffer_backing_texture, 0);
|
||||||
|
|
||||||
glBindTextureUnit(1, m_framebuffer_backing_texture);
|
glBindTextureUnit(1, m_framebuffer_backing_texture);
|
||||||
@ -777,7 +777,7 @@ namespace glerminal
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||||
|
|
||||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB8, GRID_WIDTH * CELL_SIZE, GRID_HEIGHT * CELL_SIZE);
|
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGB8, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_screen_framebuffer_backing_texture, 0);
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_screen_framebuffer_backing_texture, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
unsigned char pixels[(GRID_WIDTH * 8) * (GRID_HEIGHT * 8) * 3];
|
unsigned char pixels[(GRID_WIDTH * CELL_SIZE * CELL_SCALE) * (GRID_HEIGHT * CELL_SIZE * CELL_SCALE) * 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 * 8, GRID_HEIGHT * 8, 3, pixels, GRID_WIDTH * 8 * 3);
|
stbi_write_png("image.png", GRID_WIDTH * CELL_SIZE * CELL_SCALE, GRID_HEIGHT * CELL_SIZE * CELL_SCALE, 3, pixels, GRID_WIDTH * CELL_SIZE * CELL_SCALE * 3);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user