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

Re: [Public WebGL] WebGLSL Media Type Proposal



To me, Putting shader source in script tags is much more preferrable from a short-term development standpoint compared to using string literals (ugly) or separate files (requires file loading). This is infact how I do all my small demos, and how I would prefer simpler apps to be written. It is much more readable than the alternatives, and requires relatively little boilerplate functions to read in the contents of the script objects.

The ideal syntax for me would be shaderSource() accepting either a string or an element ID, which it will then load the text from. I don't really know the correct terminology here, but basically formalizing this exceedingly sensible syntax would seem useful.

-Jeff

----- Original Message -----
From: "Florian Bösch" <pyalot@gmail.com>
To: "David Sheets" <kosmo.zb@gmail.com>
Cc: "public webgl" <public_webgl@khronos.org>
Sent: Sunday, May 20, 2012 4:01:30 AM
Subject: Re: [Public WebGL] WebGLSL Media Type Proposal

On Sun, May 20, 2012 at 7:07 AM, David Sheets < kosmo.zb@gmail.com > wrote: 



I would like to propose the IANA registration of an official WebGLSL 
media type by Khronos and the WebGL WG. 

Sure, every file can have a mime-type. I call mine .shader, .glsl, .shaderlib, .shadertemplate, .foo and .bar. 


WebGLSL is a new language for the Web and like the other Web languages 
should have an associated media type for use in protocols like HTTP 
and tags like <script>. 

The purpose of <script> is to perform: 1) a text fetch from the server 2) execute the obtained source. This is what makes it a "script". Putting GLSL into <script> does not carry any of these conveniences, and would be in fact a poor mans XHR, since the scripttag cannot perform anything sensible on the obtained text other than making it available as text after you queried the scripptag from the DOM and looked up its innerText. 


It is generally agreed that using scripptags to transport shader source is a bad practice, and this has nothing to do with the fact that you can't src them. 

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------