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

Re: [Public WebGL] WebGLSL Media Type Proposal





----- Original Message -----
> 
> > 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.
> 
> Judging from most pieces of example code out there, including the
> ones
> suggested by the Khronos WebGL Wiki, using SCRIPT tags for shader
> programs seems like an *encouraged* practice. The examples even use
> the
> MIME types x-shader/x-fragment and x-shader/x-vertex in the SCRIPT
> tags.
> They're not official, but they're already common enough that newcomer
> me
> thought it was encouraged.
> 
> It's clumsy to pass GLSL source code as JavaScript string literals.

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.

> How
> exactly are we expected to embed non-escaped shader source code in
> HTML
> documents?

Exactly like you describe above, with <script> with these pseudo MIME types.

Maybe it would be "cleaner" to get an official MIME type for shaders, but I believe that the rationale here was to avoid including in WebGL high-level functionality that's easy to implemement on top of low-level functionality.

Benoit

> 
> If embedding is discouraged, then we're back to having external
> files.
> Are you suggesting that we use XMLHttpRequest? AJAX should be an
> optional technology, not a requirement. For external files, a MIME
> type
> would again be an advantage.
> 
> Have you got a better suggestion?
> 
> Thor
> 
> -----------------------------------------------------------
> 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
> -----------------------------------------------------------
> 
> 

-----------------------------------------------------------
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
-----------------------------------------------------------