[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGLSL Media Type Proposal

On Sun, May 20, 2012 at 5:36 PM, Benoit Jacob <bjacob@mozilla.com> wrote:
The key is they are not _javascript_ at all. The browser doesn't recognize these "x-shader/x-***" MIME types, so it doesn't try to interprete these scripts as _javascript_ or any other language.
Only the handling trough JS of these strings gives them meaning and function.
Exactly like you describe above, with <script> with these pseudo MIME types.
I think the <script> approach has a few problems right now:
- you can't src those scripts, forcing you to write all your shaders into your html, that's unmaintainable
- Even if you had src, you'd have to #1 add the scripttag via JS (because you wouldn't want to holdup the entire app for shaders that aren't used) #2 wait for the loaded event #3 obtain the scripttag from the DOM #4 extract the innerText #5 pass the innerText to the WebGL api.
- The process above is 1:1 identical to XHRs fetching text, except with an entirely different protocol.

promoting scripptags to load shaders makes as much sense as <script type="text/plain" src="" so why exactly didn't we do that?