From 48d275a01baaff68a0c055dd77664b5d0f22d70d Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sat, 10 Mar 2018 00:14:46 +0100 Subject: Dump result to image.png in current folder. --- BuddhaTest/src/BuddhaTest.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'BuddhaTest/src/BuddhaTest.cpp') diff --git a/BuddhaTest/src/BuddhaTest.cpp b/BuddhaTest/src/BuddhaTest.cpp index 57edc14..d1b6a66 100644 --- a/BuddhaTest/src/BuddhaTest.cpp +++ b/BuddhaTest/src/BuddhaTest.cpp @@ -14,8 +14,8 @@ int main() unsigned int bufferWidth = 1600; unsigned int bufferHeight = 900; - unsigned int orbitLengthRed = 100; - unsigned int orbitLengthGreen = 10; + unsigned int orbitLengthRed = 10; + unsigned int orbitLengthGreen = 100; unsigned int orbitLengthBlue = 1000; GLFWwindow* window; @@ -124,6 +124,15 @@ int main() glfwPollEvents(); } + glMemoryBarrier(GL_ALL_BARRIER_BITS); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, drawBuffer); + { + const unsigned int pixelCount{(bufferWidth * bufferHeight)*3}; //*3 -> RGB + std::vector readBackBuffer(pixelCount); + glGetBufferSubData(GL_SHADER_STORAGE_BUFFER,4*2,4 * pixelCount,readBackBuffer.data()); //offset of 2*4, that's the dimension integers. + Helpers::WriteOutputPNG(readBackBuffer,bufferWidth,bufferHeight); + } + glfwTerminate(); return 0; } -- cgit v1.2.3