Author Topic: Object loading  (Read 3935 times)

Offline amrish90

  • byte
  • *
  • Posts: 4
    • View Profile
Object loading
« 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Object loading
« Reply #1 on: January 08, 2014, 09:16:27 pm »
Which file format are you using and how big is this model?

Offline amrish90

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Object loading
« Reply #2 on: January 13, 2014, 10:11:16 am »
I am loading .obj format and .mtl file... The file size is approx. 3mb...

Offline amrish90

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Object loading
« Reply #3 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..

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Re: Object loading
« Reply #4 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

Code: [Select]

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

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

Code: [Select]
class InitObject extends Thread {

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

and change initObjects() to

Code: [Select]
private void initObjects() {
    InitObject i = new InitObject();
    i.start();
}


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



   
« Last Edit: January 13, 2014, 01:37:48 pm by Irony »

Offline amrish90

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Object loading
« Reply #5 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.

Offline Irony

  • long
  • ***
  • Posts: 151
    • View Profile
Re: Object loading
« Reply #6 on: January 13, 2014, 03:40:23 pm »
How do you do the drawing of the dialog?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Object loading
« Reply #7 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