loading more than once scene

View previous topic View next topic Go down

loading more than once scene

Post  sodapunk on Mon Sep 29, 2008 2:18 pm

the normal code for opening a scene and extracting all its resources works fine. I want to add another object in though, so I want to open another scene file.
I added the same open/extract code into the templateRender() function, but it doesn't seem to work. I think it might be replacing the first scene with the second one.

What's the correct procedure for this?

here's my code
Code:

sio2ResourceOpen( sio2->_SIO2resource,
                "Scene1.sio2", 1 );
   while( i != sio2->_SIO2resource->gi.number_entry )
   {
      sio2ResourceExtract( sio2->_SIO2resource );
      ++i;
   }
   sio2ResourceClose( sio2->_SIO2resource );

sio2ResourceOpen( sio2->_SIO2resource,
                "Scene2.sio2", 1 );
   while( i != sio2->_SIO2resource->gi.number_entry )
   {
      sio2ResourceExtract( sio2->_SIO2resource );
      ++i;
   }
   sio2ResourceClose( sio2->_SIO2resource );

cheers

sodapunk

Posts : 7
Join date : 2008-09-28

View user profile

Back to top Go down

Re: loading more than once scene

Post  sio2interactive on Mon Sep 29, 2008 4:37 pm

Hummmm not sure what can be wrong in your case but this is the code that I test to check if it work fine and it did:


sio2ResourceOpen( sio2->_SIO2resource,
"the_clearing.sio2", 1 );


while( i != sio2->_SIO2resource->gi.number_entry )
{
sio2ResourceExtract( sio2->_SIO2resource );
++i;
}

sio2ResourceClose( sio2->_SIO2resource );


sio2ResourceOpen( sio2->_SIO2resource,
"tutorial08.sio2", 1 );

// In your code I don't see that you reset i to 0 maybe that's the problem?
i = 0;
while( i != sio2->_SIO2resource->gi.number_entry )
{
sio2ResourceExtract( sio2->_SIO2resource );
++i;
}

sio2ResourceClose( sio2->_SIO2resource );



sio2ResourceBindAllImages( sio2->_SIO2resource );

sio2ResourceBindAllSoundBuffers( sio2->_SIO2resource );

sio2ResourceBindAllMaterials( sio2->_SIO2resource );

sio2ResourceBindAllInstances( sio2->_SIO2resource );

sio2ResourceBindAllPhysicObjects( sio2->_SIO2resource,
sio2->_SIO2physic );

sio2ResourceGenId( sio2->_SIO2resource );

sio2PhysicPlay( sio2->_SIO2physic );
sio2->_SIO2window->fps = 20;

// Set my rendering loop callback
sio2->_SIO2window->_SIO2windowrender = kmHomeScreenRender;
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: loading more than once scene

Post  sodapunk on Mon Sep 29, 2008 10:08 pm

yeah I messed up and didn't put i=0;

thanks for that

sodapunk

Posts : 7
Join date : 2008-09-28

View user profile

Back to top Go down

Re: loading more than once scene

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum