Billboarding causes GC [update]

Started by Irony, June 23, 2013, 02:13:15 PM

Previous topic - Next topic

Irony

After seeking the reason for frequent GCs in my code for half of last night I found it's the ships' engine glow (a semi-transparent plane with additive blending).
To be exact it's the billboarding on them. Removing setBillboarding(true) eliminates nearly all GCs.
I suppose I could do the billboarding calculation myself, but maybe it's possible for you to take a look. Thx!

EgonOlsen

Strange, because i'm using bill boarding a lot and never experienced this. I'll look into it...

EgonOlsen

If you are using billboarded child objects, an unoptimized part of the code will be used that creates up to 3 additional matrices per frame. If should be fixed in this version: http://jpct.de/download/beta/jpct_ae.jar. The code is untested...i hope that it still does the same thing just with less instance creations...

Irony

Sorry but no, the children are not where they're supposed to be..

EgonOlsen

Damn...i'll have a look again.

EgonOlsen

Please re-download the beta and try again. This time, i did some tests...it should work now.

Irony


Irony

Hi Egon,
the billboarding works fine now, but I have a different problem in this beta.
The following error occurs when loading one specific model, however the exact same code works with previous versions of JPCT. Any idea?

06-24 09:43:40.470: I/jPCT-AE(8216): Processing object from 3DS-file: alien_spac
06-24 09:43:40.560: I/jPCT-AE(8216): Object 'alien_spac_jPCT269' created using 2556 polygons and 1465 vertices.
06-24 09:43:40.560: I/jPCT-AE(8216): Loading Texture...
06-24 09:43:40.590: D/dalvikvm(8216): GC_FOR_ALLOC freed 1608K, 42% free 31861K/54407K, paused 28ms
06-24 09:43:40.630: D/dalvikvm(8216): GC_FOR_ALLOC freed <1K, 40% free 32885K/54407K, paused 24ms
06-24 09:43:40.630: I/jPCT-AE(8216): Texture loaded...1048576 bytes/512*512 pixels!
06-24 09:43:40.865: I/size(8216): 0 471.4535
06-24 09:43:40.865: I/jPCT-AE(8216): Loading file from InputStream
06-24 09:43:40.865: I/jPCT-AE(8216): File from InputStream loaded...305 bytes
06-24 09:43:40.985: W/dalvikvm(8216): threadid=13: thread exiting with uncaught exception (group=0x40c5b1f8)
06-24 09:43:40.990: E/AndroidRuntime(8216): FATAL EXCEPTION: GLThread 517
06-24 09:43:40.990: E/AndroidRuntime(8216): java.lang.NullPointerException
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.threed.jpct.Loader.loadBinaryFile(Loader.java:1200)
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.threed.jpct.Loader.loadBinaryFile(Loader.java:1124)
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.threed.jpct.Loader.load3DS(Loader.java:1541)
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.threed.jpct.Loader.load3DS(Loader.java:165)
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.ironman_project.space.object.SpaceObject.loadModel(SpaceObject.java:156)
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.ironman_project.space.object.SpaceObject.setModelAndTexture(SpaceObject.java:98)
06-24 09:43:40.990: E/AndroidRuntime(8216):    at com.ironman_project.space.object.SpaceObject.<init>(SpaceObject.java:118)




EgonOlsen

Opps...yes, i've changed something in that method to reduce the garbage it creates. I worked fine in my test cases, but something is obviously wrong with it. I'll look into it later today.

EgonOlsen

Please re-download the beta. The nullpointer should be fixed now.