Q:

Is it possible to callback C/C++ function/code in a GLSL shader when conditions are met?

Is it possible to run C/C++ code from a GLSL shader? E.g. in fragment shader pixel X,Y is reached so call a C/C++ function then continue as normal. (Since the screen size is very small and functions will be very small as well, performance shouldn't be a huge issue.)

A:

No. Consider the GPU as an special machine that works only with GLSL programs. But you can write that function (in GLSL language, not C/C++) and call it in the shader. If you are going to use in a fragment shader, then compile this function as a fragment shader too and link it to the program where you use it.
The calling shader must declare this function, otherwise it's ignored.

