diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 12c12e1b..174f0489 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -11,6 +11,7 @@ function(buildExample EXAMPLE_NAME) if(EXISTS ${EXAMPLE_FOLDER}/${EXAMPLE_NAME}.h) SET(MAIN_HEADER ${EXAMPLE_FOLDER}/${EXAMPLE_NAME}.h) ENDIF() + find_package(OpenMP) # imgui example requires additional source files IF(${EXAMPLE_NAME} STREQUAL "imgui") file(GLOB ADD_SOURCE "../external/imgui/*.cpp") @@ -38,6 +39,10 @@ function(buildExample EXAMPLE_NAME) endif(WIN32) set_target_properties(${EXAMPLE_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) + if(OpenMP_CXX_FOUND) + message(STATUS "OpenMP found") + target_compile_options(${EXAMPLE_NAME} PRIVATE ${OpenMP_CXX_FLAGS}) + endif() if(RESOURCE_INSTALL_DIR) install(TARGETS ${EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/examples/texture3d/texture3d.cpp b/examples/texture3d/texture3d.cpp index 1a7769f0..65a0427f 100644 --- a/examples/texture3d/texture3d.cpp +++ b/examples/texture3d/texture3d.cpp @@ -308,11 +308,11 @@ public: const float noiseScale = static_cast(rand() % 10) + 4.0f; #pragma omp parallel for - for (uint32_t z = 0; z < texture.depth; z++) + for (int32_t z = 0; z < texture.depth; z++) { - for (uint32_t y = 0; y < texture.height; y++) + for (int32_t y = 0; y < texture.height; y++) { - for (uint32_t x = 0; x < texture.width; x++) + for (int32_t x = 0; x < texture.width; x++) { float nx = (float)x / (float)texture.width; float ny = (float)y / (float)texture.height;