Author Topic: some questions  (Read 2503 times)

Offline fir3d

  • byte
  • *
  • Posts: 11
    • View Profile
some questions
« on: May 14, 2010, 06:20:39 pm »
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?
« Last Edit: May 14, 2010, 08:54:50 pm by fir3d »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: some questions
« Reply #1 on: May 15, 2010, 09:48:17 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: some questions
« Reply #2 on: May 15, 2010, 10:31:50 pm »
Forgot about the thread question: yes.

Offline fir3d

  • byte
  • *
  • Posts: 11
    • View Profile
Re: some questions
« Reply #3 on: May 16, 2010, 03:40:26 pm »
thanks for the help!

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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: some questions
« Reply #4 on: May 16, 2010, 11:10:07 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: some questions
« Reply #5 on: August 31, 2011, 12:08:14 am »
What is controlling (and starting) the repainting?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: some questions
« Reply #6 on: August 31, 2011, 06:51:55 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?

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: some questions
« Reply #7 on: August 31, 2011, 05:10:44 pm »
Yeah, that was it. So to make a game loop for your Hello World, one would have to call something like (or exactly like)
Code: [Select]
renderer.setRenderMode(RENDERMODE_WHEN_DIRTY);
right? And to repaint:
Code: [Select]
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)?
« Last Edit: August 31, 2011, 09:34:20 pm by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: some questions
« Reply #8 on: September 01, 2011, 01:04:45 pm »
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.