Updating shader code

    Jun 03 2013 | 12:10 pm
    Anybody has an idea if i can update shader code without saving to file and reloading with jit.gl.slab or jit.gl.shader? I mean if i'm editing the code as text inside max, then send out that text to the appropriate shader object?

    • Jun 04 2013 | 8:31 am
      The best I know is described in the following Jitter example patch -> jitter-examples/render/shaderwriter-example.pat
      Not sure if this answers your question though...
    • Jun 04 2013 | 11:04 am
      Thanx, it's a good way of editing shaders, but it still saving the file before reloading... what's not so bad, just was wondering if i can do without it... maybe there is an external or java class for that...
    • Jun 04 2013 | 12:54 pm
      I know of no way in Max with the default objects/externals to load a shader program in any way other than from a file system path.
      You could use the Max SDK and write your own OpenGL external in C which can do exactly what you want. I've written externals using the SDK and I caution you that it is not a trivial task. I don't recommend you do it for this feature. I doubt the time/effort you would invest will give you any significant advantage over reading in a file.
      Instead, I suggest you look into the file i/o features of Max, Javascript, Java, or LUA to generate, save, and then load a shader program file (JXS) into a jit.gl.shader.
    • Jun 04 2013 | 6:15 pm
      Thanx Dale, yeah for sure i can do it by writing and rereading and not a heavy processing soultion at all, just thought, it's some kind of resource waste to use the HDD for this :D i dont' think i'll try to do my OpenGL external for this... didnt coded openGL in C yet, so would be a too long learning curve i guess...