Hi,

After a long time I came back to this task.

Now I am able to run this in 32 bit machines. If I run it on 64 bit  (win-7 and 
winXP)machines then some times the application crashes. 

My development environment is Windos - XP 32 bit with SP3.

I think we can run 32 bit applications on 64 bit machines with out any errors.

I am using only ".OSG" files. 

Here I am giving what I did

//GLOBLES

Code:
struct ModelObj
{
        Model *obj;
        int id;
};


HANDLE T[NUM_OF_MODELS];
CWinThread *pThread[NUM_OF_MODELS];

UINT ThreadProc1(LPVOID lpvoid)
{
                ModelObj *temp = (ModelObj*)lpvoid;
        
                temp->obj->mtForMarker[temp->id] = new osg::MatrixTransform;
                
temp->obj->modelSwitch->addChild(temp->obj->mtForMarker[temp->id].get());
                temp->obj->modelForMarker[temp->id] = 
osgDB::readNodeFile(temp->obj->fileNames[temp->id]);

                if(temp->obj->modelForMarker[temp->id])
                {
                        
temp->obj->mtForMarker[temp->id]->addChild(temp->obj->modelForMarker[temp->id].get());
                        
                        
temp->obj->mtForMarker[temp->id]->addChild(temp->obj->sound_root.get());
                    temp->obj->mtForMarker[temp->id]->setUpdateCallback( 
temp->obj->soundCB.get() );
                }

        

        return 0;
}



In main

Code:
.........

ModelObj obj[NUM_OF_MODELS];
for(int i=0;i<NUM_OF_MODELS;i++)
                        {
                                obj[i].id=i;
                                obj[i].obj=&model;
                        }

strcpy(model.fileNames[0],"osg_01.osg");
                        strcpy(model.fileNames[1],"osg_02.OSG");
                        strcpy(model.fileNames[2],"osg_03.OSG");

DWORD ThreadId[NUM_OF_MODELS];
                        for(int i=0;i<NUM_OF_MODELS;i++)
                        {
                                pThread[i]=new CWinThread;
                                pThread[i] = AfxBeginThread (ThreadProc1, 
(LPVOID)&obj[i]);

                                pThread[i]->m_bAutoDelete=FALSE;

                        }

                        for (int j = 0; j < NUM_OF_MODELS; j ++)
                        {
                                T[j] = pThread[j]->m_hThread;
                        }

                        ::WaitForMultipleObjects(NUM_OF_MODELS, T, TRUE, 
INFINITE);

                        for (int j = 0; j < NUM_OF_MODELS; j ++)
                        {
                                delete pThread[j];
                        }


... 

I am using OSGSound also. 

Is there any special care should I take for 64 bit machines.

If I am not using threads then loading of OSG files taking more time (With out 
threads nearly 40 sec and With Threads around 19 sec. ).

Can you please help me to solve this problem.

Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50170#50170




_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to