Summary: To reverse a program must clearly know the structure of the program and commonly used API functions, it is not clear a program to reverse the result is not possible to drop
First, the GLSL script runs the entire process, the first step is to create a container for shader run Gluint glcreateprogram (void), the second step is to attach the compiled shader to the program void Glattachshader (Gluint program, Gluint Shader), compiled shader can be multiple so the second step can repeat multiple steps to add each of the compiled one by one to the application, vertex shader and pixel shader one by one pair, the third step is void Gllinkprogram ( Gluint program) is used to connect these programs, and the fourth step void Gluseprogram (Gluint prog) uses it.
To extract the script, we need to know how to compile shader in the second step how to pass a string, compile shader is divided into three steps, one is to create a container gluint glcreateshader (Glenum shadertype), and the other is to add source code void Glshadersource (gluint shader, int numofstrings, const char **strings, int *lenofstrings), and three are compiled void Glcompileshader ( Gluint shader)
Understand these at a glance to know to extract shader is when it added the original code when the breakpoint, compile and other functions are not related to the string, only Glshadersource is to add the source, the other functions are useless, found the key function to see the parameters, the third parameter is a string pointer, After the broken down in the Register R2 print out, p * (char**) $r 2, run one time off to print once, all copied out all the shader are extracted.
The reverse process looks very simple, mainly familiar with the process of the program to find the key function, the fault is more and more away