Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/heightmap: Fixed Windows build #1062

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/heightmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ if (NOT APPLE)
link_directories(${GLEW_LIBRARY_DIRS})
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()

configure_file (example_config.hh.in ${PROJECT_BINARY_DIR}/example_config.hh)

Expand Down
7 changes: 7 additions & 0 deletions examples/heightmap/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glut.h>
#else
#include <GL/glut.h>
#endif

#include <iostream>
Expand All @@ -39,8 +41,13 @@
using namespace gz;
using namespace rendering;

#if not defined(_WIN32)
const std::string RESOURCE_PATH =
common::joinPaths(std::string(PROJECT_BINARY_PATH), "media");
#else
const std::string RESOURCE_PATH =
common::joinPaths(std::string(PROJECT_BINARY_PATH), "..", "media");
#endif

//////////////////////////////////////////////////
void createImageHeightmaps(const ScenePtr _scene, VisualPtr _root)
Expand Down
11 changes: 9 additions & 2 deletions tutorials/21_heightmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,27 @@ It loads 2 different heightmaps (image and Digital Elevation Model (DEM)) with d

## Compile and run the example

Clone the source code, create a build directory and use `cmake` and `make` to compile the code:
Clone the source code, create a build directory and use `cmake` to compile the code:

```{.sh}
git clone https://github.com/gazebosim/gz-rendering
cd gz-rendering/examples/heightmap
mkdir build
cd build
cmake ..
make
# Linux
cmake --build .
# Windows
cmake --build . --config Release
```
Example 1 (image heightmap):

```{.sh}
# Linux
./heightmap

# Windows
.\Release\heightmap.exe
```

You'll see:
Expand Down
Loading