diff --git a/dgl/src/OpenGL.cpp b/dgl/src/OpenGL.cpp index 739669cd..aa2c3960 100644 --- a/dgl/src/OpenGL.cpp +++ b/dgl/src/OpenGL.cpp @@ -681,8 +681,10 @@ void Window::PrivateData::renderToPicture(const char* const filename, glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels); fprintf(f, "P3\n%d %d\n255\n", width, height); - for (uint y = 0; y < height; y++) { - for (uint i, x = 0; x < width; x++) { + for (uint y = 0; y < height; y++) + { + for (uint i, x = 0; x < width; x++) + { i = 3 * ((height - y - 1) * width + x); fprintf(f, "%3d %3d %3d ", pixels[i], pixels[i+1], pixels[i+2]); } diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp index e869fa67..ce0dce32 100644 --- a/dgl/src/WindowPrivateData.cpp +++ b/dgl/src/WindowPrivateData.cpp @@ -748,7 +748,6 @@ void Window::PrivateData::onPuglExpose() if (widget->isVisible()) widget->pData->display(); } -#endif if (char* const filename = filenameToRenderInto) { @@ -757,6 +756,7 @@ void Window::PrivateData::onPuglExpose() renderToPicture(filename, getGraphicsContext(), static_cast(rect.width), static_cast(rect.height)); std::free(filename); } +#endif } void Window::PrivateData::onPuglClose()