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.


Topics - nouknouk

Pages: [1]
1
Support / Applet & memory concerns
« on: October 20, 2008, 02:45:55 pm »
Hi,

I'm just a new user of JPCT: i'm currently evaluating the possibility to use JPCT to make 3D applet games.

For the moment, i just did a really basic try: instanciating something like 50 objects from a 3ds file:
Code: [Select]
                Object3D[] objects = Loader.load3DS("pesanthouse.3ds", 0.03f);
                for (int i=0; i<7; ++i) {
                    for (int j=0; j<7; ++j) {
                        Object3D pivot = Object3D.createDummyObj();
                        for (Object3D o2 : objects) {
                            Object3D o = o2.cloneObject();
                            o.setTexture("house");
                            o.getMesh().compress();
                            o.build();
                            pivot.addChild(o);
                            world.addObject(o);
                        }
                        pivot.translate(i*8.f, j*8.f, 0.f);
                        pivot.build();
                        world.addObject(pivot);
                    }
                }


The 3ds object looks reasonable in size, with somehting like 1000 polygons and the texture is about 1MB:
Quote
Loading file pesanthouse.3ds
File pesanthouse.3ds loaded...51691 bytes
Processing new material 01 - Default!
Texture named ROOF.JPG added to TextureManager!
Processing new material 02 - Default [Bo!
Processing object from 3DS-file: Box01
Object 'Box01_jPCT2500' created using 124 polygons and 64 vertices.
Processing object from 3DS-file: Box02
Object 'Box02_jPCT2501' created using 124 polygons and 64 vertices.
Processing object from 3DS-file: Box04
Object 'Box04_jPCT2502' created using 762 polygons and 532 vertices.

I'm afraid when i launch this code (as an application, even not yet as an applet), because I get an OutOfMemoryError.

As I know applets are even more constraining than application (64MB of max memory if I remember well)
That's why, I have more and more doubts about the possibility to use JPCT in my applet.

My goal is to make some kind of '3D top view' (something like that). Thus, 50 objects like my house will be something quickly reachable.

Here's my question: do you see any problem inside my code, or any reason that makes my code use more memory than needed ?

Many thanks in advance.

Pages: [1]