some questions

Started by fir3d, May 14, 2010, 06:20:39 PM

Previous topic - Next topic

fir3d

1.) I searched on google and I couldnt find it anywhere. What does it mean to serialize a mesh? ???

2.) in the source of the simple demo there is no thread made to draw the graphics (game loop), is the ondrawframe automatically run in a different thread?


3.) I keep on getting out of memory when trying to load the 3ds object. What should be a good number of polygons for a model to use in an android game?

EgonOlsen

On this page: http://www.jpct.net/jpct-ae/ you'll find an alpha version of jPCT 1.21 (the desktop version, not the Android one). That one contains a new class called DeSerializer. You can use this class to load a model on your workstation and serialize it to a file for the android version. You can then use the Loader-class of AE to load it. This serves three purposes:


  • Loading is a fast as it gets on Android
  • Memory consumption is as low as it gets
  • Startup time is lower if you already called build() on the model before serializing it

Some more information can be found here: http://www.jpct.net/forum2/index.php/topic,1578.0.html

If you are having problems with that alpha version of 1.21, here's a more recent jar: http://www.jpct.net/download/beta/jpct.jar

The OOM-Exception from the 3ds loader comes from the fact that the loader has to do some parsing, which consumes additional memory. Loading a serialized object doesn't require this, so models loaded that way can be larger.

EgonOlsen

Forgot about the thread question: yes.

fir3d

thanks for the help!

whats the best way to add shadows in android, or is it not possible yet?

EgonOlsen

Either bake it into the texture if possible (i.e. for static meshes) or use some planar shapes below the objects (i.e. "blob shadows"). There's no support for shadow mapping in hardware and even if it were, it would be much to slow on current hardware anyway.

AGP

What is controlling (and starting) the repainting?

EgonOlsen

Quote from: AGP on August 31, 2011, 12:08:14 AM
What is controlling (and starting) the repainting?
I'm not sure what you mean with that question? Who controls the call to onDrawFrame()? Android. You can switch to some manual mode if you want to, but by default, it calls it every *whatever* ms. Was that your question?

AGP

#7
Yeah, that was it. So to make a game loop for your Hello World, one would have to call something like (or exactly like)

renderer.setRenderMode(RENDERMODE_WHEN_DIRTY);

right? And to repaint:

renderer.requestRender();

Is that the way you would do it, or would you just recommend that the game loop be called by renderer.onDrawFrame(GL10)?

EgonOlsen

I use to put my calls to the game logic into the onDrawFrame() method and let Android manage the repaints. I never bothered with RENDERMODE_WHEN_DIRTY.