[lively-kernel] WebGL projects [was: Re: Lively Kernel as plugin...]
arto.salminen at tut.fi
Thu Sep 16 06:57:21 CEST 2010
I think the easiest way to see the code is to press Ctrl+U (see the
source) or Ctrl+Shift+J (developer tools) in Chrome.
On the left HTML5 canvas there is the experimental canvas version of the
Lively Kernel. On the right side is another HTML5 canvas with WebGL
(which is used with a library called GLGE).
There is a xml file called mylevel.xml that is used to define the GLGE
scene. In this xml, the cube and the canvas used as a texture for the
cube are defined.
In my demo code (demo.js) I use HTML5 canvas API (i.e. function called
drawImage(image, dx, dy, dw, dh)) to draw the Lively Kernel canvas on
certain places on to the texture canvas of the cube. This drawing is
done in every 33 milliseconds.
I believe that, the left side canvas could be used as a texture for the
cube directly, but because textures are "wrapped" around objects, it
would look weird. Haven't test this though.
Dan Ingalls wrote:
> Arto, this is great! Glad to see you making progress.
> I haven't had a chance to look at the code (is there an easy way?), but I'm curious how you render to the faces of the cube. Is there some way you are "pasting" part so the world image onto the cube, or are you actually using Lively's Canvas display mode to render onto each face? I am hoping the latter, as it would mean that you have essentially all the canvas display protocol (fonts and all) working to the WebGL canvas. Is this true?
> Either way, it's great to see the beginnings ;-)
> - Dan
More information about the lively-kernel