Hello fellow Appthusiasts,
I’m hoping to save some texture memory usage by using display.captureScreen to transition from one scene to the next. I’m aware of previous attempts by the community (Director class), and even most recently by Corona themselves with Storyboard to help developers be able to handle loading and unloading and generally smooth transitioning between scenes.
My problem is that the scene the user is viewing, prior to the transition, I’m using up almost all the available texture memory (yes, you can go over 24 MB of texture memory, but I’ve noticed that in many cases, when you do, the device crashes, so this isn’t an option). So in all current implementations of scene switching, even with the Storyboard or Director solutions (even with my own custom written code), in order to smoothly transition to the next scene and do something like a dissolve, the NEXT scene needs to be preloaded, and the current scene must remain on screen. Since I’m already using up all my available texture memory, I cannot preload the next scene without going beyond the limit.
SO! My thought was, would it be possible to use display.captureScreen to take a screenshot and use that as my visual placeholder for a dissolve transition. So my code would look something like this:
- Scene loads & plays (texture mem: 20 mb)
- Scene ends, take screenshot via display.captureScreen and bring this screenshot to the front of my display (texture mem: 24 mb - assuming 4 mb for 1024 x 768 image on iPad)
- Unload my current scene (texture mem: 4 mb)
- Load the upcoming scene, positioning characters behind the screenshot (texture mem: 24 mb)
- Change the alpha of the screenshot overtime, dissolving the last scene into the next one (texture mem: 20 mb)
- celebrate the cinematic awesomeness!!!
This seems like a sound plan, BUT for the life of me, I can’t get display.captureScreen to function as it seems to me that it should. Calling the function display.captureScreen( true ), I get the handle of the cap back, but nothing comes up on my screen as in the example. I can see the saved file on my file system, so the function is kiiiiiiinda working, except when I view the file, it’s all black!! So it didn’t cap the screen, but it tried to… it is however the correct resolution 1024 x 768 (I’m on Windows, btw… haven’t tested this on Mac yet).
In the example, the user is rendering rects and circles and capturing that. I am using sprites and background images. Is there a difference?
Thanks in advance for the help!
Regards,
Scott D Brooks
Little Halo Games [import]uid: 63276 topic_id: 21982 reply_id: 321982[/import]
