Пример #1
0
        public static WebGLShader createShader(this WebGLRenderingContext gl, Shader source)
        {
            // jsc/java should pick this up!
            FragmentShader refhack;

            var type = gl.VERTEX_SHADER;

            //if (source is FragmentShader)
            var IsFragmentShader = source is FragmentShader;

            if (IsFragmentShader)
            {
                type = gl.FRAGMENT_SHADER;
            }

            var shader = gl.createShader(type);



            // we could just use object.ToString

            // later we might want to update jsc to create a special interface method for that..

            var code = source.ToString();

            // or jsc could replace a method to "compile" a type into actual source code :)
            // ahead of time or on runtime? (.net 5 code expressions?)

            // how do WebGLShader and Shader relate?

            // will actionscript require the same extensions?

            gl.shaderSource(shader, code);

            gl.compileShader(shader);

            return(shader);
        }