diff options
author | Andreas Grois <andi@grois.info> | 2018-03-10 00:14:46 +0100 |
---|---|---|
committer | Andreas Grois <andi@grois.info> | 2018-03-10 00:14:46 +0100 |
commit | 48d275a01baaff68a0c055dd77664b5d0f22d70d (patch) | |
tree | 93ebda133ea0ede266151b18772da6ca995607dd /BuddhaTest/src/BuddhaTest.cpp | |
parent | d9d395f85ec1ab1c8959118300d6e8be56d090e6 (diff) |
Dump result to image.png in current folder.
Diffstat (limited to 'BuddhaTest/src/BuddhaTest.cpp')
-rw-r--r-- | BuddhaTest/src/BuddhaTest.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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<uint32_t> 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;
}
|