I strictly followed instructions in section “Shader Subroutines” of Chapter 2 of the red book for OenGL 4.5, but I always got -1 return from glGetSubroutineUniformLocation and glGetSubroutineIndex. The code is exactly copied from the book and I have checked again and again for any syntax error. The code is minimized and the newest driver installed – everything a newbie OpenGL programmer could figure out is tried. So I have to guess that the subroutine uniform and subroutine are not active and there are some APIs not covered by the red book can activate them. If so, what are they? If not, what is wrong with my code and how to fix it?
Environment: Windows 7, Visual Studio 2015, GeForce 640, newest nVidia driver 384.76 installed
Source code: Please see the attachement.
Thanks a lot.