Object loading

Started by amrish90, January 08, 2014, 12:39:26 PM

Previous topic - Next topic

amrish90

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.

EgonOlsen

Which file format are you using and how big is this model?

amrish90

I am loading .obj format and .mtl file... The file size is approx. 3mb...

amrish90

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..

Irony

#4
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.



   

amrish90

I am doing the same but i am not able to get progress dialog is not showing.

Irony

How do you do the drawing of the dialog?

EgonOlsen

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