Updating shader code

Jun 3, 2013 at 5:10am

Updating shader code

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?

#251488
Jun 4, 2013 at 1:31am

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…

#251630
Jun 4, 2013 at 4:04am

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…

#251645
Jun 4, 2013 at 5:54am

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.

#251659
Jun 4, 2013 at 11:15am

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…

#251679

You must be logged in to reply to this topic.