Would you like to react to this message? Create an account in a few clicks or log in to continue.

Loading a new scene

2 posters

Go down

Loading a new scene Empty Loading a new scene

Post  freebird373 Sat Nov 22, 2008 7:23 pm

Someone asked about loading scenes using custom loading (good practice of lazy loading for iPhone memory usage).

I want to verify that this is the correct way to accomplish this:

1) First release previous scene

// release previous scene
sio2ResourceUnloadAll( sio2->_SIO2resource );
sio2->_SIO2resource = sio2ResourceFree( sio2->_SIO2resource );
sio2->_SIO2resource = 0;

2) Load in a new scene

// load in new scene
sio2->_SIO2resource = sio2ResourceInit();
sio2->_SIO2window->_SIO2windowrender = loadScene( sceneName );

void loadScene( const char* resourceFile ) {
// same as templateLoading() but
// with this line you provide the passed in resource file name
sio2ResourceOpen( sio2->_SIO2resource, resourceFile, 1 );

Thanks for this engine, great work! Very helpful to visualize in blender and then dump out to code, real time saver:)
Bullet physics is great too.



Posts : 10
Join date : 2008-11-21

Back to top Go down

Loading a new scene Empty Re: Loading a new scene

Post  sio2interactive Sun Nov 23, 2008 1:26 am

Yup you get it all covered... what you can do also is:

1. Create another thread using SIO2thread

2. Create another SIO2resource handle

3. Load all the resources in the other thread

4. Then GenId in the main thread when its done loading... and bind the SIO2resource handle...

(just make sure that you are not calling any GL instruction while loading the resource from the other thread as there's no GL context created)

Hope this help!


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

Back to top Go down

Back to top

- Similar topics

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