I wonder if there is a way to prevent "OpenGL Profiler" or "Instruments" to be attached to my application, because it reveal some shaders/process I would like to keep hidden.
-
1What do you mean? Are your shaders such a break-through that they constitute a trade secret? – Brett Hale Sep 20 '13 at 08:22
-
1Nope. There's no way to do that and I can't think of a reason you'd want to. – Robinson Sep 20 '13 at 09:55
-
It's just to prevent competitors to copy my shaders. – vtruant Sep 20 '13 at 11:59
2 Answers
There is no way to do this. The best you can do is to obfuscate your shaders so they are hard to decipher, for instance by using some code that gives all methods and variables non-descriptive names.
The reason you can't prevent someone from capturing the content of your shaders and textures is that you have to pass them to the OpenGL API. In theory, someone could replace the appropriate methods in the API with implementations that simply save the shaders/textures to their hard drive. You have no way of knowing if this has been done.

- 1,201
- 6
- 17
-
2**+1**: Also, Cg does a great job of turning shaders into an obfuscated collection of poorly named variables when translated to GLSL. `cgc` works both ways, so if you really want to obfuscate GLSL shaders you could probably run them through `cgc` a few times. NV drivers use Cg as the GLSL compiler front-end, so sometimes you can actually see the truly awful things that it does to GLSL shaders in the output of `glGet{Program|Shader}InfoLog (...)` :) – Andon M. Coleman Sep 20 '13 at 23:04
The way I did is to crypt shaders that are in the application, so if a user check the content of the app, he will find *.vsh and *.fsh but he won't be able to read it. And I decrypt them just before the compilation.
In my render pass, I've added
#if RELEASE
CGLSetGlobalOption(kCGLGOComment, (long) "No profiler in release scheme");
#endif
By adding it, the application will crash when openGL profiler tries to attach. So shaders won't be visible.

- 273
- 1
- 12