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 ... 8 9 [10] 11 12 ... 16
136
Support / Re: JPCT Coordinate system
« on: January 17, 2012, 08:44:19 am »
What I do is orientate the object in the 3D program itself so it loads correctly in jPCT. Y pointing down and Z facing you does the trick (in Blender at least).

137
Support / Re: Overlay with NVidia Tegra II GPU
« on: January 17, 2012, 08:38:29 am »
Maybe the eclipse project just needed to be cleaned. Often happens to me when I can't figure out strange glitches and problems.

138
Support / Re: Overlay with NVidia Tegra II GPU
« on: January 16, 2012, 08:21:54 am »
All 3D objects and textures should be loaded from the main OpenGL activity thread. The first call to the GLSurfaceView.Renderer onSurfaceChanged() function is a good place to load initialize the scene including all textures.

Do you have multiple Activity classes or launching multiple runnables/threads? If yes, those extra threads should not load anything 3D related.

Also ensure the texture files are placed in res\drawable-nodpi or res\raw so they don't get resized automatically by Android.




139
That's true, 256MB is what I get on a Tegra2 3.2 Tablet with 1GB RAM. If it's a 'no-name' Tablet with say only 512MB total RAM then I wouldn't expect much of an increase.

140
Ah that's what is using so much memory, I thought you had just a basic 3D scene.

I had the same issue when I jumped from Gingerbread to Honeycomb, the RAM usage was almost double and could not figure out why. I'm assuming it's the result of Android taking advantage of the larger RAM sizes in newer devices to minimize GC pauses.

There is a simple solution but you will need to have separate APK's for 2.x and ICS.
Honeycomb introduced the large heap parameter in the AndroidManifest.xml file which increases the application RAM from the usual 16GB/24GB/32GB size to 256MB.

Add android:largeHeap="true" to this tag:
<application android:icon="@drawable/icon" android:largeHeap="true" android:label="@string/app_name" android:debuggable="false">

Also ensure the minimum SDK is set to 11 if you want Honeycomb support, or 14 for just ICS support.

141

Another option would be to use the DDMS tool to view the memory heap usage while the app is running. http://developer.android.com/resources/articles/track-mem.html

16MB is quite a lot for a basic scene with a skybox. My app has about 100 objects (some models have 4000+ vertices) with 15 decent sized textures amongst other things and the RAM usage is only 26MB.


Post up your code if you wish, we may be able to spot the problem.

142
Something must be using too much memory. If you are allocating large arrays, null them after usage so the garbage collector frees them.

Use the below function at various areas during initialization to see how the RAM accumulates. For example, call logMem() before loading all the textures, and then after they are loaded.

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

        String sRAMString = "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, sRAMString);
}

1024x1024 textures use a big chunk of memory when loading them so think about decreasing the size to 512x512

143
Forgot about the drawable folder, the images will also be resized if in that folder.

144
What res folder are the images placed in?

If they are in drawable-hdpi, drawable-mdpi, or drawable-ldpi, there is a good chance that they are being resized automatically to match the DPI of the screen.

Create a folder called drawable-nodpi, move the images in there, then clean and refresh the project.

145
Try placing your image files in res\drawable-nodpi to avoid resizing and downsize the 768x768 image to 512x512 to keep the GPU happy.

146
Support / Re: Collision exception
« on: January 10, 2012, 02:05:17 am »
Yes it matters. If you are modifying 3D objects while jPCT is drawing it can cause exceptions.

You should update the object movement and rotation in the same thread from within the onDrawFrame(GL10 gl) function. Use a frame delta (time elapsed since the previous frame) to move/rotate your objects, for example: translationVector.x += fSpeed * fDelta;

147
Support / Re: Out of memory, performance issues
« on: January 09, 2012, 08:43:43 am »
You have over 16MB already used up so you are running out of RAM when uploading the textures.  The textures themselves don't use much Application RAM after being loaded since they are sent to the GPU VRAM, so you basically need to cut down on the other resources. i.e. use low poly objects or clone the objects if loading the same object multiple times, or load the textures first before anything else.

148
Support / Re: ClearRotation resets the scale
« on: December 22, 2011, 05:50:31 pm »
Remember to set it to 1 BEFORE calling clearRotation(). Or otherwise, setScale(x) won't scale by x but by former_scale/x.

..and setting the scale to 1f beforehand fixed the other issue I ran into.
All good now, cheers.

149
Support / Re: ClearRotation resets the scale
« on: December 22, 2011, 05:32:52 pm »
Ok no worries I'll implement the workarounds as suggested.

Usually I don't hide object by setting the scale very low but in my current situation I scale a few objects to zero moments before relocating the object somewhere else out of view. I can understand negative scale values but the 0 scale is where it got me. I now know for future reference :)


150
Support / Re: ClearRotation resets the scale
« on: December 22, 2011, 05:17:35 pm »
ok I'll make sure I do that. (edit: I thought setScale was absolute? whereas .scale() was incremental?)

In my own functions I prefer to implement internal fixes/workarounds for invalid parameters rather than throw an exception to keep my functions solid/reliable (in this case, default to 0.001f as the scale if invalid) , but I can see how throwing an exception can help with debugging for others in general.

Pages: 1 ... 8 9 [10] 11 12 ... 16