www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: amrish90 on January 08, 2014, 12:39:26 PM

Title: Object loading
Post by: amrish90 on January 08, 2014, 12:39:26 PM
I am new to JPCT-AE. I am able to load the 3D object but it is taking a lot of time. I want to show a progress dialog till the 3d object is loaded. Can anyone help me with this issue or to increase the performance.
Title: Re: Object loading
Post by: EgonOlsen on January 08, 2014, 09:16:27 PM
Which file format are you using and how big is this model?
Title: Re: Object loading
Post by: amrish90 on January 13, 2014, 10:11:16 AM
I am loading .obj format and .mtl file... The file size is approx. 3mb...
Title: Re: Object loading
Post by: amrish90 on January 13, 2014, 10:25:42 AM
I am working on Augmented Reality Project. Here i need to load the 3Dobject over the camera preview. The object is taking time to load so i require a progress dialog. Can anyone help me for this..
Title: Re: Object loading
Post by: Irony on January 13, 2014, 01:34:43 PM
You can load your objects in a new thread and meanwhile, show a blinking "Loading" message or whatever on your main thread.

So, if you had a function like that before


private void initObjects() {
// ...load your objects
}


you can add another class (even in the same source file for convenience)


class InitObject extends Thread {

public void run() {
loading=true;
// ...load your objects
                loading=false;
        }


and change initObjects() to


private void initObjects() {
    InitObject i = new InitObject();
    i.start();
}



and check for "loading" in the render thread. Something like that.



   
Title: Re: Object loading
Post by: amrish90 on January 13, 2014, 02:01:50 PM
I am doing the same but i am not able to get progress dialog is not showing.
Title: Re: Object loading
Post by: Irony on January 13, 2014, 03:40:23 PM
How do you do the drawing of the dialog?
Title: Re: Object loading
Post by: EgonOlsen on January 13, 2014, 08:19:15 PM
I don't really know about the dialog thing, but if loading time in general is a problem, consider to use serialized objects instead: 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)