Some ui stuff

This commit is contained in:
Martin committed 2025-01-24 14:45:38 +01:00
1 parent 4545be6c88
commit ad619de1dc
2 files changed
+7 -2

No files matched your search

+5 -2
View File
@@ -57,9 +57,11 @@ void loadData(float* d_data, const int idx, const int timestep) {
void Window::saveImage() {
unsigned char* pixels = new unsigned char[this->w * this->h * 3];
glReadPixels(0, 0, this->w, this->h, GL_RGB, GL_UNSIGNED_BYTE, pixels);
const char* filename = "output.ppm"; // TODO: make this the current time
std::ofstream imageFile(filename, std::ios::out | std::ios::binary);
char str[512];
sprintf(str, "output%d.ppm", this->i++);
std::ofstream imageFile(str, std::ios::out | std::ios::binary);
imageFile << "P6\n" << this->w << " " << this->h << "\n255\n";
for (int i = 0; i < this->w * this->h * 3; i++) {
imageFile << pixels[i];
@@ -86,6 +88,7 @@ void framebuffer_size_callback(GLFWwindow* window, int w, int h) {
int Window::init(float* data) {
this->data = data;
this->i = 0;
// init glfw
glfwInit();
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.