www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Gopinath on January 10, 2014, 04:33:42 pm

Title: Pre loader for opengl
Post by: Gopinath on January 10, 2014, 04:33:42 pm
I have lots of objects (.pbj) to be loaded along with its texture. It is taking more time around 7 secs to load everything. I would like to add a loading message meanwhile for the user to know whats happening. I am clueless on how to show this in opengl / jpct-ae. It can be even simple text like "Loading...." at the center of the screen
Title: Re: Pre loader for opengl
Post by: EgonOlsen on January 10, 2014, 05:06:18 pm
The simplest way might be to use Toast (it's a class in the Android SDK). It displays little text blobs on screen that fade away automatically.
Title: Re: Pre loader for opengl
Post by: Gopinath on January 10, 2014, 06:27:29 pm
Thank you for your suggestion. Will use that to indicate user
Title: Re: Pre loader for opengl
Post by: Gopinath on January 12, 2014, 10:47:33 pm
I had included the Toast with duration as Toast.LONG. Still it is too short for my need as it takes more time around 10 secs to finish loading. So after certain reference I looped the toast 3-4 times so it displays little longer duration. Is this good method?
Title: Re: Pre loader for opengl
Post by: Irony on January 13, 2014, 01:36:54 pm
I'd initialize the object in another thread and display a message while this thread is running. For longer load times, you even must do something like that if you want to avoid the dreaded "application deadlock" message.
Take a look at this pretty similar thread:
http://www.jpct.net/forum2/index.php/topic,3772.0.html (http://www.jpct.net/forum2/index.php/topic,3772.0.html)
Title: Re: Pre loader for opengl
Post by: EgonOlsen on January 13, 2014, 08:17:36 pm
I had included the Toast with duration as Toast.LONG. Still it is too short for my need as it takes more time around 10 secs to finish loading.
The Toast doesn't have to use one of the constants. You can define your own value (not sure if this really helps, but it might be worth a try).
Title: Re: Pre loader for opengl
Post by: Gopinath on January 16, 2014, 06:18:33 pm
EgonOlsen & Irony, my customer is expecting to have a progress bar indicator or a pre-loader similar to web application or in the gaming applications while the objects are being loaded. So the idea of Toast does not solve the purpose here. So need assistance to figure this out.
Title: Re: Pre loader for opengl
Post by: EgonOlsen on January 16, 2014, 08:25:49 pm
If you are already in an OpenGL enabled Activity, you could simply put the loading part in a different thread and render an empty world while it works (and blit that progress bar of course). Just make sure that the switching after the loading is synchronized or done in the render thread.

Have you considered to use serialized objects (http://www.jpct.net/wiki/index.php/Differences_between_jPCT_and_jPCT-AE#Performance_and_memory_issues.2C_serialized_objects (http://www.jpct.net/wiki/index.php/Differences_between_jPCT_and_jPCT-AE#Performance_and_memory_issues.2C_serialized_objects)) to speed up the loading process (just in case you haven't done this already)?
Title: Re: Pre loader for opengl
Post by: Gopinath on February 09, 2014, 02:01:25 pm
Thanks for your inputs. That seems to be the best option. But I have not tried it. Rather I had optimized & reduced the texture images to load little faster to meet the customer expectation. On the other side, will try your suggestion.