When I come across situations like these while compiling, I usually search it in apt-cache.
For example, if the programs complain about a missing libglut.so.3, I'll remove the lib part and all the extension and search with just glut. Searching this way returned this result
libkwinglutils7 - KDE window manager gl utils library
libkwinglutils6 - KDE window manager gl utils library
libkwinglutils1abi3 - library with OpenGL utilities for the KDE window manager
libkwinactiveglutils1abi3 - library used by accellaration for the KDE window manager Active
freeglut3 - OpenGL Utility Toolkit
python-opengl - Python bindings to OpenGL (Python 2)
libkwinglutils1 - library used by accellaration for the KDE window manager
freeglut3-dbg - OpenGL Utility Toolkit debugging information
freeglut3-dev - OpenGL Utility Toolkit development files
libghc-glut-dev - Haskell GLUT binding for GHC
libghc-glut-doc - Haskell GLUT binding for GHC; documentation
libghc-glut-prof - Haskell GLUT binding for GHC; profiling libraries
libhugs-glut-bundled - A binding for the OpenGL Utility Toolkit
libmgl-glut7.4.0 - library for scientific graphs (glut interface for windows)
libtaoframework-freeglut-cil-dev - Tao CLI binding for freeglut - development files
libtaoframework-freeglut2.4-cil - Tao CLI binding for freeglut
pfsglview - command line HDR manipulation programs (OpenGL/GLUT viewer)
mgltools-mglutil - Molecular Graphics Laboratory utility collection
Now, I'll only consider the packages with -dev suffix, because these are the packages with development libraries. There are only two of them. freeglut3-dev and libghc-glut-dev. I'll go for freeglut3-dev because it seems most relevant.
apt-fileor http://packages.ubuntu.com. These are mentioned in the first link you gave. – edwinksl Aug 26 '16 at 11:57apt-filein that link is definitely the right answer, but i didn't realize it! On the other hand, that question asks about a 'file' and only the bonus question relates to my issue. Also, it seems like many questions similar to mine have been closed due to similarity with that question. But at first sight, they aren't very similar, so I and other people get confused by this. – Jonatan Öström Aug 26 '16 at 12:08apt-fileand googling are the best options but @Anwar is right.apt-fileis slow and depends on pre-existing data. – James Aug 26 '16 at 20:54