Rasmus Agerholm schrieb:
The RemoteAspect (and the ChangeList) are there to handle the
replication for you with something like

Sending side:

  RemoteAspect *aspect;
  Connection *connection;
  ...setup connection...
  aspect->sendSync(*connection, Thread::getCurrentChangeList());
  connection->flush();

Receiving side:

  RemoteAspect *aspect;
  Connection *connection;
  ...setup connection...
  connection->selectChannel();
  aspect->receiveSync(*connection);

I read in the documentation that the connection->selectChannel() call locks the channel for exclusive read. Do I have to unlock it again manually? Or does the flush() operation do that? (In that case I would have to add a connection->flush() after the aspect->receiveSync(...))

I tried putting
  aspect->sendSync(*connection, Thread::getCurrentChangeList());
  connection->flush();
  Thread::getCurrentChangeList()->clearAll();
in the display callback method (GLUT) of my scene server (which hosts the scene that the clients want to render), and
  connection->selectChannel();
  aspect->receiveSync(*connection);
  mgr->redraw();
  Thread::getCurrentChangeList()->clearAll();
  glutSwapBuffers();
in the display callback of my client.

However, this doesn't seem to work yet. I get lots of "LOG: BinaryDataHandler ReadError: read got 0 bytes!" (this occurs on the aspect->receiveSync(*connection) call in the client display loop), and the client doesn't seem to get the scene data. I read a VRML scene from a file, and added it to my scene graph between beginEditCP() and endEditCP() calls in my server (before setting up the connection, but also before clearing the change list). I also tried adding objects (torus) to the scene on the server during runtime (using a keyboard callback), also between beginEditCP() and endEditCP() calls, but the client doesn't seem to get those changes...


Be ware of your begin-/endEdit calls, since only changes made in between
these will be replicated!

I've got begin-/endEditCP calls around all my scene graph changes on the server side, but how does the RemoteAspect know where to apply those changes? I mean, I create a node (which my SimpleSceneManagers use as root) in both server and client via Node::create(), but how does the RemoteAspect know these are my root nodes?


The register* functions of the remote aspect is there to let you do
stuff when special field containers are created, changed and/or
destroyed. For example you might want to collect a handle to all Switch
node(core)s in a vector the moment they are created and throw away the
handles the moment the nodes are destroyed.

Yes, I expected that (I looked at the examples), though I wasn't sure. I guess this scheme will become useful for my application later on ;-)


Anyway, thanks for the answer, I'll experiment with the RemoteAspect for now...

You're welcome... and I think experimentation is the best way to get to
know how all this works. Hopefully you can now do some "guided"
experimentation :-)

Absolutely. At least I know I'm on the right track. The clustering chapter in the documentation is a bit too brief for me to get a deeper understanding... By the way, how does the developer doc differ from the user doc anyway, I couldn't find any changes on first glance (apart from the user doc .pdf being a few KB shorter...) ;-)

/Rasmus

Thanks again,
  Robert



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to