Loading custom shaders
Hi evanw,
I'm working on a shader building enviroment you can see the very very early release here http://shady-oio.dotcloud.com/
I am using glfx as it really nicely hides all the webgl stuff i;m not too familiar with.
I wanted to know if there is a clean way to load shaders to the canvas element currently i iam using this code
this.canvas[name] = fx.wrap(function(time) {
code = code.replace(/\n/g,'');
codeShader = new fx.Shader(null, code);
fx.simpleShader.call(this, codeShader, {
time: time,
resolution: [this.width, this.height]
});
return this;
})
which had required me to export the wrap,Shader and simpleShader functions that were hidden. Is there a better way to do this?
in addition i add a globle time uniform, which was great if it was built in the lib
great stuff (by the way)
(Credit page is in the making)
I agree this would be a nice feature. It would probably be a good idea to support the creation of a simple shader using a single call, but still allow users to drop down to lower level calls for multi-pass techniques. Doing this well would probably involve quite a bit of refactoring.