Hi Rene,
On Tue, 2005-06-21 at 13:20 +0200, Rene Weller wrote:
> Hello,
>
> thanks for the fast reply.
> I tested your program (but left out the qt-stuff. Is that the key?), and
> everything works fine. But when I put the "NEW STUFF" back in the
> main-method (see code below), the same failure happens again, the cast in
> the rotate-method failes. I first thought that this is just another strange
> fault on my weird machine (VS2002 with intel-compiler, OpenSG 1.2), but i
> tried it on another one (Linux, gcc, OpenSG 1.4) an the same error appears.
> Or is it necessary to create the scene in the second threat?
ah, now I see what you mean.
No, you don't have to create the scene in the second thread. But if you
want to access it in the second thread, you have to apply the first
thread's change list, even if you create the thread after you created
the scene. You also have to set the ChangeLists to read/write, otherwise
no changes are recorded.
Here's what I had to change to make this work:
*** 81multithreading.cpp.bak 2005-06-21 14:49:45.000000000 -0500
--- 81multithreading.cpp 2005-06-21 14:58:17.361296990 -0500
***************
*** 93,99 ****
int main(int argc, char **argv)
{
! // ChangeList::setReadWriteDefault();
osgInit(argc,argv);
int winid = setupGLUT(&argc, argv);
--- 93,99 ----
int main(int argc, char **argv)
{
! ChangeList::setReadWriteDefault();
osgInit(argc,argv);
int winid = setupGLUT(&argc, argv);
***************
*** 132,137 ****
--- 132,140 ----
animationThread = dynamic_cast<Thread *>(ThreadManager::the()
->getThread("anim"));
+ // apply changes to aspect 1
+ Thread::getCurrent()->getChangeList()->applyTo(1);
+
//do it...
animationThread->runFunction(rotate, 1, NULL);
Hope it helps
Dirk
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users