[X3D-Public] Shader programming and URLs in X3D

Johannes Behr johannes.behr at igd.fraunhofer.de
Thu May 14 09:34:52 PDT 2009

On 14 May 2009, at 15:32, Michalis Kamburelis wrote:

> Peter Eschler wrote:
>> Hi,
>> On Wed, May 13, 2009 at 8:56 PM, John A. Stewart  
>> <alex.stewart at crc.ca> wrote:
>>> Hi All;
>>> I'm verifying the Shader support code in FreeWRL, and I have a  
>>> question.
>>> The url field, can it contain the source, or does it always have to
>>> designate a file? eg, with scripting, one can have a url starting  
>>> with
>>> "javascript ..." and it will be treated as source, not as a url.
>> InstantPlayer supports both approaches.
>> See the following example:
>> http://www.instantreality.org/tutorial/shader-programs/
> Ah, just without protocol. Thanks! Any documentation how exactly the
> fact that we have direct shader source code is detected?

The rule and code is very simple: Single line is URL and external.  
(What a "single line"
is depends on the encoding) and multiple lines are shader code in the  
x3d file.

Works for classic-encoding (url-field) and xml/cdata encoding.

This works already for years and we had a discussion on a protocol:- 
at the time we implemented this. However we did not like it since the
kind of language is already defined by the type-field.

best regards

> I just added this to view3dscene. URL is recognized as direct shader
> source if it doesn't start with any protocol *and*
> has some newlines (needed to recognize relative URLs without protocol
> correctly).
> Michalis
> _______________________________________________
> X3D-Public mailing list
> X3D-Public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org

Dr.-Ing. Johannes Behr	tel: +49-6151-155-510
Fraunhoferstr. 5			fax: +49-6151-155-196
D-64283 Darmstadt		skype: johannesbehr
Germany				web: www.igd.fhg.de/www/igd-a4/

More information about the X3D-Public mailing list