vineri, 16 septembrie 2011

X3DOM - part 001.

What is X3DOM?
The official website gives us the answer.
X3DOM (pronounced X-Freedom) is an experimental open source framework and runtime to support the ongoing discussion in the Web3D and W3C communities how an integration of HTML5 and declarative 3D content could look like. It tries to fulfill the current HTML5 specification for declarative 3D content and allows including X3D elements as part of any HTML5 DOM tree.
We try to use it.
The official site tell us about the browsers and X3DOM.
Internet Explorer 9 = does/will not support WebGL. So you have to install the InstantReality-plugin or Flash 11.
Google Chrome ver 9.x = supports WebGL natively.
Firefox >= 4.x = supports WebGL natively.
Safari (Mac only: Safari 5.1 on OS X 10.6 and 10.7) = include support for WebGL (Windows version does not), but you need enable it through the “Developer”-menu. To activate the “Developer”-menu go to Preferences->Advanced and check the “Show Developer menu in menu bar” button.
Let's check it!
First, check here if your browser supports X3DOM.
If your browser not supports X3DOM , you will see this :
Also , the running example will show you this:
Now, Let's try a simple example. Create a html file and paste the code:
<!DOCTYPE html>
 <title>TEST X3DOM</title>
 <link rel="stylesheet" type="text/css" href="" /></link>
 <script type="text/javascript" src=""></script>
<h1>Show box under x3dom !</h1>
<x3d width="500px" height="500px">
    <material diffuseColor='blue'></material>
Also if you want then we can install this (instantreality Framework 2.0).
I managed to run version 6.0.2 Firefox example by changing the settings WebGL.
I wrote in the address bar about:config and I looked and changed the setting:
webgl.force-enabled to true.
Open the file with the Firefox web browser.We can see one blue box...
... and Chrome Web Browser (ver. 13.0.782.220 m)with this result:
Under IE , I got errors ... Although I have installed the InstantReality-plugin or Flash 11.
You can see more examples here.