generated from Persson-dev/OpenGLComputeShader
3d projection
This commit is contained in:
14
src/Main.cpp
14
src/Main.cpp
@@ -10,7 +10,7 @@
|
||||
#include <random>
|
||||
|
||||
constexpr int WORK_GROUP_SIZE = 64;
|
||||
constexpr int PARTICLE_COUNT = WORK_GROUP_SIZE * 10000;
|
||||
constexpr int PARTICLE_COUNT = WORK_GROUP_SIZE * 15625;
|
||||
|
||||
constexpr int SWAP_INTERVAL = 1;
|
||||
|
||||
@@ -106,7 +106,7 @@ static void ErrorCallback(int error, const char* description) {
|
||||
|
||||
static void ApplyTransforms(const std::vector<glm::mat4>& transformations) {
|
||||
glUseProgram(s_ComputeShader);
|
||||
glUniformMatrix4fv(1, transformations.size(), true, glm::value_ptr(transformations[0]));
|
||||
glUniformMatrix4fv(1, transformations.size(), false, glm::value_ptr(transformations[0]));
|
||||
}
|
||||
|
||||
static void GenNewFractal() {
|
||||
@@ -233,6 +233,13 @@ static GLFWwindow* InitWindow() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto viewMatrix = glm::lookAt(glm::vec3{1, 2, 2}, {0, 0, 0}, {0, 1, 0});
|
||||
auto projectionMatrix = glm::perspective(70.0f, 2.0f, 0.01f, 10.0f);
|
||||
|
||||
glUseProgram(s_GraphicsShader);
|
||||
glUniformMatrix4fv(0, 1, false, glm::value_ptr(viewMatrix));
|
||||
glUniformMatrix4fv(1, 1, false, glm::value_ptr(projectionMatrix));
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -252,7 +259,8 @@ int main() {
|
||||
|
||||
glBindVertexArray(vertexArray);
|
||||
|
||||
ApplyTransforms(SIERPINSKI_TRIANGLE);
|
||||
// ApplyTransforms(SIERPINSKI_TRIANGLE);
|
||||
GenNewFractal();
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
// ScopedTimer timer("Main Loop");
|
||||
|
||||
Reference in New Issue
Block a user