OpenGL application that reacts weirdly (Help) Debugging?

This usually happens because the application expects to be run with the current working directory set to the directory where the executable is. This is not the case when applications are run from Tracker, instead they start with the current directory being the home folder.

So, the application needs to look for its own files.

One simple fix is to add chdir(dirname(basename(argv[0]))); at the start of the function.
This does:

  • Take the application path from argv[0]
  • Resolve it if it is a symlink (for example if the app is started from a link in DeskBar)
  • Find the parent directory
  • Set that to be the current directory

Then the app can find its own files.