Hey Diego,

> Some of the scenarios I would like to enable:
>  - moving around the scene using a server-side API; should not require
> resending the scene.
>
>
> Would this be equivalent to move the camera with server-side commands?

Yes.

>  - moving around the scene using client-side changes (this will be
> something special)
>
>
> This is given in WebGL as long as there aren't new objects coming into the
> scene (server updates)

Is it so? I was under the impression that WebGL, like OpenGL, always
requires to push all the   triangles through the rendering pipeline
when updating the camera position? Although I can believe that this
might make JavaScript the bottle neck, I could not find a simple
example where they simply change the camera and the current scene is
renders itself in the new camera position?

>  - animation: defining a JavaScript function that allows animation;
>
>
> This should be also sraight forward. For instance you could interpolate
> camera locations and create a spline (very much like in Blender). Again,
> with the client-side API.
>
>  - modifying the scene by adding/removing or moving around objects;
> should not require resending the entire scene, only the changes
>
>
> Agreed. This is "Second Life" style.

Oh oh. Let's not bring bad omen over our WebGL support :-)

> You are right. WebGL is procedural. GLGE is object based
> (http://www.glge.org/api-docs/?url=/symbols/GLGE.Mesh.html&url=/index.html)
> . These objects could be mapped to C++ objects or encapsulated depending on
> the level of granularity that you want to give to the API.

Okay. That might then be the right starting point.

> Also, what would be a good starting point to start playing with WebGL in Wt?
> Maybe the JavascriptExample project? or maybe the PaintExample?
> I am thinking of something very quick to implement just to have a proof of
> concept. From there I will move onto architectural details.

I think you could start using a widget that specializes WText.

In the WText, you put "<canvas></canvas>" element, and then you add
methods which draw on this canvas, using doJavaScript(). You can get a
JavaScript reference to the canvas element using the C++ expression
(jsRef() + ".firstChild"), which you can use within the doJavaScript()
statements.

As a tip, to avoid dealing with string literals for all your
JavaScript experiments, you can use the following macro trick to keep
your JavaScript as actual program text (see also my blog post about
this):

#define WT_JS(...) #__VA_ARGS__

std::string canvasEl =  jsRef() + ".firstChild;
app->doJavaScript(WT_JS(
  function(canvas) {
    alert('hey there ' + canvas);
  }
) + "(" + canvasEl + ");"));

Regards,
koen

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to