Pre loader for opengl

Started by Gopinath, January 10, 2014, 04:33:42 PM

Previous topic - Next topic

Gopinath

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

EgonOlsen

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.

Gopinath

Thank you for your suggestion. Will use that to indicate user

Gopinath

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?

Irony

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

EgonOlsen

Quote from: 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.
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).

Gopinath

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.

EgonOlsen

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) to speed up the loading process (just in case you haven't done this already)?

Gopinath

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.