www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: ramzes0071 on January 19, 2014, 12:25:56 PM

Title: GLSurfaceView slows for a moment
Post by: ramzes0071 on January 19, 2014, 12:25:56 PM
Hi,

I need some help. I have my game renderer and it works ok, but at some point of time I add another Object3D (it is added to world from the beginning but is invisible, so I change only its visibility) and when it appear, for a moment my game slow down, fps too. This action occurs only when I first time do this manipulation. When I repeat it again everything looks ok. My Object3D is't complex.

I don't know what is going on. Do you have  any solutions for this problem?
Title: Re: GLSurfaceView slows for a moment
Post by: EgonOlsen on January 19, 2014, 02:19:44 PM
That's because objects need some processing before they can be displayed. By default, this happens at runtime when the object will be rendered for the first time. You can use World.compileAllObjects() to shift a huge part of that workload to the setup phase.
Title: Re: GLSurfaceView slows for a moment
Post by: EgonOlsen on January 19, 2014, 02:22:44 PM
Texture uploads can be another issue. You can use TextureManager.preWarm(...) to pre-upload textures.
Title: Re: GLSurfaceView slows for a moment
Post by: ramzes0071 on January 19, 2014, 03:19:07 PM
I have World.compileAllObjects(), and now I added TextureManager.preWarm(...) .
Looks fine  :)
thx
Title: Re: GLSurfaceView slows for a moment
Post by: Irony on January 31, 2014, 01:23:29 PM
As this seems to be a relatively common issue, and it's pretty hard to figure out for a beginner, I have added a page to the Wiki under "Advanced topics" (did not want to add it to performance tips as those all seem to be for Android in general, not JPCTAE specific)
Hope that's ok!