diff --git a/CMakeLists.txt b/CMakeLists.txt index 94ecca2..b8ecfd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ set(OpenGL_GL_PREFERENCE "GLVND") find_package(OpenGL REQUIRED) find_package(GLUT REQUIRED) find_package(GLEW REQUIRED) +find_package(OpenMP REQUIRED) find_package(PkgConfig REQUIRED) pkg_search_module(SDL2 REQUIRED sdl2) @@ -54,7 +55,7 @@ set(SRCS "src/simulation.cpp") # Define C++ compiler flags -set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wpedantic -Wfatal-errors -Werror -pedantic-errors -fno-elide-constructors") +set(CMAKE_CXX_FLAGS "-std=c++11 ${OpenMP_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wfatal-errors -Werror -pedantic-errors -fno-elide-constructors") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3") diff --git a/src/cube.cpp b/src/cube.cpp index 8bc6860..68ea0ae 100644 --- a/src/cube.cpp +++ b/src/cube.cpp @@ -84,6 +84,7 @@ void cube::render() { } void cube::shift_colors() { + #pragma omp parallel for for(size_t i = 0; i < colors.size(); ++i) { colors[i] += color_ascending[i] ? color_shift : diff --git a/src/cube.hpp b/src/cube.hpp index eb54c48..316226a 100644 --- a/src/cube.hpp +++ b/src/cube.hpp @@ -36,7 +36,7 @@ public: void render(); private: - const float color_shift = 0.0001; + const float color_shift = 0.005; void shift_colors(); // OpenGL buffers