Hi!
I'm working on a project where we're using OpenSG (with
cluster-rendering) to render our “world”. The problem is that we would
like to interact with this world, i.ex. create new boxes and spheres in
realtime. I've used the tutorial file 13ClusterClient and modified it.
I've only rebuilt it so i can create an object of ClusterClient. On this
object i would like to add nodes and such during execution.
We have a main program starts a seperate thread that creates an
ClusterClient “object”. This object runs the initialize code for
ClusterClient and proceeds running the GLUT main loop.
In this case: ClusterClient *client = new ClusterClient(... , ...)
While this thread is running the GLUT main loop, we'd like to in our
main-thread add additional nodes, remove nodes or modify existing nodes.
I've tried to create new objects using makeTorus but the program gets a
segmentation fault. The line NodePtr foo = makeTorus(.5,2,16,16); just
crashes the program.
This is the function that crashes the program, located in ClusterClient
void addTorus(){
NodePtr foo = makeTorus(.5,2,16,16);
beginEditCP(scene);
scene-addChild(foo);
endEditCP(scene);
}
I run this function from the main-thread using:
clusterclient->addTorus(); but this crashes the program.
I've also tried to from the main-thread get the scene, and add a new
object to the scene.
NodePtr *bar = client->getSceneRoot();
NodePtr foo = makeTorus(.5,2,16,16);
beginEditCP(bar);
bar->addChild(foo);
endEditCP(bar);
But this also creates a segmentation fault. Also on the line: NodePtr
foo = makeTorus(.5,2,16,16);
It seams like I'm only allowed to make changes to the scene in the
“display” function that exists in ClusterClient. But this function is
only run by the ClusterClient thread that I've created. Thus I cannot
change anything on the scene externally.
Does anyone have any idea how i can solve this or go around the problem?
Many thanks!
// Martin
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users