Skip to content

Conversation

@3a2l
Copy link

@3a2l 3a2l commented Nov 4, 2020

Hi Yahia,

This fixes a bug where the examples will fail to load or run because the paths to assets (shaders, models, etc.) are using relative paths.

I defined a base ASSETS_DIR using CMake (for all projects) and concatenated that with the existing strings (minus the "assets" part).

I tested a few examples and they seem to work now.

3a2l

@yahiaetman
Copy link
Owner

That's a really good idea.
The only problem with this approach is that the absolute path will be hardcoded and thus it can't be packaged as a portable application after build. Though this shouldn't be a problem if the code is meant for educational purposes only, I still want to keep an option for it to be built and packaged (since this will be used as a reference for a course project).
I think I'll add an option to CMake to control whether the path should be absolute or relative.

@3a2l
Copy link
Author

3a2l commented Nov 7, 2020

Could perhaps add an option for reading an environment variable ASSETS_PATH (or something similar). So the behaviour becomes:

  • Read environment variable, if defined, use it.
  • If not defined, fall back to the compile time definition (to be controlled during compilation with the CMake script).

I'm fine with implementing this if you like this approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants