Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - K24A3

Pages: 1 ... 10 11 [12] 13 14 ... 16
166
Support / Re: gravity
« on: December 01, 2011, 12:51:02 am »
You can use the 'checkForCollision' functions, have a look at this example:
http://www.jpct.net/wiki/index.php/Advanced_example

167
Support / Re: OutOfMemoryError on ICS
« on: November 30, 2011, 11:48:52 am »
I have the same problem with Honeycomb. For some reason the app uses double the RAM compared to Gingerbread. You can use the new LargeHeap parameter in Android.Manifest to increase the RAM to 256MB but you will lose Gingerbread compatibility.

Use this function to see how much RAM is used in both gingerbread and ICS:

Code: [Select]
public void logMem() {
        DecimalFormat df = new DecimalFormat();
        df.setMaximumFractionDigits(0);
        df.setMinimumFractionDigits(0);

        String sTemp = "RAM allocated: " + df.format(new Double(Runtime.getRuntime().totalMemory()/1048576)) + "MB of " + df.format(new Double(Runtime.getRuntime().maxMemory()/1048576))+ "MB (" + df.format(new Double(Runtime.getRuntime().freeMemory()/1048576)) +"MB free)";
        Log.v(TAG, sTemp);
    }

168
Support / Interpolate smoothly between animation sequences
« on: November 30, 2011, 11:43:31 am »

When changing the sequence from say object3D.animate(fAnim, 1) to object3D.animate(fAnim, 2) causes the animation to snap instantly.

Is there an option to interpolate smoothly between sequences? Or must this be done manually by controlling the float index so the index is reset to zero before switching sequences? (assuming that each sequence uses the same mesh when at index 0f)

169
Support / Re: gravity
« on: November 30, 2011, 08:20:28 am »
You basically need to add translation on the Y Axis to the Object3D at each frame.

For example (very simple example):

onFrame()
{
    myObject3D.Translate(0f, 0.01f, 0f);
}

jPCT doesn't have a Physics engine so create your own or use something like jBullet.

170
Support / Re: Huge RAM usage when rendering
« on: November 30, 2011, 08:14:13 am »
Those values are with the garbage collector triggered, you have to do that anyway to get the heap dump file. I have the RAM usage displayed on the Android device and DDMS, there is almost no difference before and after (most I saw was ~20KB difference).

Honeycomb introduced the large heap size which gives you the option to increase the RAM limit per app to 256MB so perhaps google decided to do some major heap restructuring to take advantage of the increased RAM. Invisible free space to accommodate object growth and minimize GC pauses perhaps?

The large heap option in the manifest isn't available in Gingerbread and earlier so I guess I'll just need to create a separate APK for Tablets.

171
Support / Re: Huge RAM usage when rendering
« on: November 30, 2011, 05:24:05 am »
The high RAM usage is also happening on an Omap 4430 PowerVR Tablet running Android 3.2, which happens to be the exact same CPU/GPU as the Phone.

I used the Eclipse Memory Analyzer to view the object sizes. Object3D is using the most RAM which is no surprise, but the Object3D RAM usage is double on the Tablet which is strange. The byte[] array count is also a concern. 418K on the phone, 10MB on the tablet :O

The same APK was used on both devices.


[ PHONE ]
Class Name              | Objects | Shallow Heap | Retained Heap
-----------------------------------------------------------------
com.threed.jpct.Object3D|      79 |       28,440 |  >= 5,656,544
byte[]    |   2,483 |      418,152 |    >= 418,152
-----------------------------------------------------------------





[ TABLET ]
Class Name              | Objects | Shallow Heap | Retained Heap
-----------------------------------------------------------------
com.threed.jpct.Object3D|      79 |       28,440 | >= 11,867,800
byte[]    |   3,214 |   10,232,480 | >= 10,232,480




I attached a comparison of the objects that are using the most RAM.

I'm thinking it's a Honeycomb issue in relation to memory mapping or object management.




[attachment deleted by admin]

172
Support / Re: Huge RAM usage when rendering
« on: November 28, 2011, 12:31:36 pm »
It would be very interesting indeed. I'll have a look if there are any heap debugging functions in Android and try an Omap Tablet running 3.2.
I'm guessing it's an inefficiency in 3.1 or a Tegra2 driver/design issue.

173
Support / Huge RAM usage when rendering
« on: November 27, 2011, 04:07:06 am »
I'm seeing a huge difference between the RAM usage on a phone and a tablet. My project only uses 16MB/32MB on the phone, but 45MB/48MB on the Tablet. The Tablet intermittently throws an out of memory exception when rendering. (I'm using jPCT 1.24)


To rule out a bug in my project, I created a test app with 50 spheres using no texture. I clone 49 spheres from the first sphere.

In the test app, the Tablet is using 20MB compared to 9MB on the phone.


PowerVR Omap4430 Gingerbread 2.3.5 phone:
- 6MB/32MB after loading textures
- 8MB/32MB after calling world.buildallobjects()
- 9MB/32MB when rendering

Tegra2 Honeycomb 3.1 Tablet:
- 8MB/48MB after loading textures
- 9MB/48MB after calling world.buildallobjects()
- 20MB/48MB when rendering

I tried MemoryHelper.compact(), mesh.compress(), but it made little difference.
I tried using Primitives.getSphere() on all 50 objects instead of using clone(), but that only increased the usage by one or two MB.

I doubt it's a screen resolution problem because they are not much different.
Phone: 960×540
Tablet: 1280x800

I doubt there is a memory leak, the RAM usage is generally consistent after 20 minutes.

I can't figure out why so much RAM is used. Perhaps the Tegra2 OpenGL driver is inefficient? Or is jPCT loading extra poly/vertex information on the Tablet?


Attached are the logs and main class.


[attachment deleted by admin]

174
Support / Re: why my texture can't show on md2 model?
« on: October 29, 2011, 06:09:51 pm »
How did you create the 3D Model?

Maybe it's missing UV texture co-ordinates.

Try using the jPCT Object3D function to calculate the texture using sphere mapping to get around invalid UV co-ordinates.

175
Support / Re: JPCT works int Android 3.x??
« on: October 29, 2011, 06:06:05 pm »
I'll let you know next week :p

176
Support / Re: JPCT works int Android 3.x??
« on: October 28, 2011, 06:23:17 pm »
Yes it will work. I use jpct in v3.1 with no problem.

177
Support / Re: why my texture can't show on md2 model?
« on: October 28, 2011, 06:19:44 pm »
Are your textures in a 'drawable-xxdpi' folder?

Place your textures in 'drawable-nodpi' to stop Android from resizing the textures automatically.

178
Support / Re: Rotate an object to match another object's rotation matrix
« on: October 20, 2011, 01:32:22 pm »
I got the auto direction/rotation working perfectly simply by testing the xy values against both quats.

For example:
      if(q2.x < q1.x) fYIncrement += 0.001f;
      else           fYIncrement -= 0.001f;
      object3D.rotateAxis(object3D.getXAxis(), fYIncrement);

Thanks Egon.

179
Support / Re: Rotate an object to match another object's rotation matrix
« on: October 20, 2011, 12:40:38 pm »
Ok I've decided to try quaternions. It's all ready to go but I'm having difficulty seeing how I can use it to determine how much the object needs to rotate to match the other object.

// I'm assuming what I need to do is put the matrix rotation into each quaternion
q1.fromMatrix(object3D.getRotationMatrix());
q2.fromMatrix(object3D.getRotationMatrix());
fRotation = q1.calcSub(q2);

Then call Object3D1.rotateAxis(getYAxis, fRotation).

I'll give that a try ..

180
Support / Re: Rotate an object to match another object's rotation matrix
« on: October 20, 2011, 10:37:41 am »
I think interpolate() is no good because I need to vary the xyz movement, and quaternion seems a bit overkill but I'll have a look anyway.

Basically I'm trying to automate the path of a plane so it rotates using preset rudder and yaw incremental values. The plane needs to slowly rotate into the destination matrix, using scaleMul to move the plane.


Pages: 1 ... 10 11 [12] 13 14 ... 16