glfx.js icon indicating copy to clipboard operation
glfx.js copied to clipboard

Loading custom shaders

Open 0i0 opened this issue 13 years ago • 1 comments

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)

0i0 avatar Jun 09 '12 13:06 0i0

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.

evanw avatar Aug 03 '12 06:08 evanw