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.


Messages - Disastorm

Pages: 1 2 3 [4] 5 6 ... 11
46
Support / Re: Out Of Memory error?
« on: July 22, 2011, 12:01:17 am »
Thanks, both the flashing and the invisible enemies are fixed with this version. 

Btw when sharing meshes If I call animate on the original Object3D will all of them animate or do I still need to call animate on each one individually?

47
Support / Re: Out Of Memory error?
« on: July 21, 2011, 09:47:17 pm »
Here is a test program http://www.sendspace.com/file/cqlcil

just run that and then double tap the screen to add the model and you should see the flash.  You might have to manually terminate the process after each run though since I didn't add in support for all those OnStop() and OnRestart and stuff.

oh yea u still havn't mentioned why my enemies might be invisible if i share the compiled data.

48
Support / Re: Out Of Memory error?
« on: July 21, 2011, 08:48:25 pm »
This object uses 3 different texture files.   Oh you are right it does look like its using the texture of the knob, i didn't notice that.  Do you know why it would be doing that?  No I'm not using libgdx.  Btw yea my screenshot looks weird like split because apparently ddms.bat that i was using to take screenshots takes them like that, on the actual screen I don't believe its ever actually split in half like that.  What actually happens is the entire object looks like that for a split second and then it becomes normal, and this only happens when i set it to sharing compiled objects.

49
Support / Re: Out Of Memory error?
« on: July 21, 2011, 08:01:58 pm »
Ok thanks.  ill try to make a test case later, however, i managed to get a screenshot (from my phone) of the instant it flashes so maybe this can give u an idea of whats happening:
http://i8.photobucket.com/albums/a23/Disastorm/device-2011-07-21-105852.png

Also do u have any ideas about my enemies why they might become invisible if i share compiled data (i suppose its also possible that their scale changes so I can't see it or something else happens)?

50
Support / Re: Out Of Memory error?
« on: July 21, 2011, 11:54:53 am »
its inside the render thread (btw this is a separate issue but I noticed alot of times in the logs it said my object wasn't built and it was forcing a build even though i have built it some time previous before cloning but I think when I build it after the clone also, then it gets rid of that message). 

here is where I originally instantiate the model before cloning (its the one called obj2):
Code: [Select]
                                Tower tower = towerMap.get(TowerType.LEAF_TOWER);
Object3D obj = Loader.loadSerializedObject(main.getResources().openRawResource(tower.getModelResourceId()));
obj.setScale(tower.getModelScale());
obj.setUserObject(tower);
tower.setModel(obj);

Object3D obj2 = new Object3D(obj, false);
obj2.setUserObject(tower);
tower.setAnimatedModel(obj2);

Object3D bullet = Loader.loadSerializedObject(main.getResources().openRawResource(tower.getBullet().getModelResourceId()));
bullet.setScale(tower.getBullet().getModelScale());
tower.getBullet().setModel(bullet);

bullet.setCollisionMode(Object3D.COLLISION_CHECK_SELF);

obj.build();
obj2.build();
bullet.build();


here is the clone method (the one called animatedModel is the one that flashes):
Code: [Select]
public Tower clone(boolean cloneStaticModel, boolean cloneAnimatedModel) {
Tower tower = new Tower(main);
tower.setCanAttackAir(canAttackAir);
tower.setCanAttackGround(canAttackGround);
tower.setDmg(dmg);
tower.setEffect(effect);
tower.setHeightPos(heightPos);
tower.setModelResourceId(modelResourceId);
tower.setModelScale(modelScale);
tower.setMsDelay(msDelay);
tower.setOnlyEffect(onlyEffect);
tower.setTile(tile);
tower.setTileRange(tileRange);
tower.setTowerName(towerName);
tower.setTowerType(towerType);
tower.setBullet(bullet);// no need to clone this
tower.setWorld(world);
tower.setPointRange(pointRange);
tower.setUseTileRange(useTileRange);
tower.setRangeCircle(rangeCircle.cloneObject());
tower.getRangeCircle().shareCompiledData(rangeCircle);

if (cloneAnimatedModel) {
tower.setAnimatedModel(new Object3D(animatedModel, true));
tower.getAnimatedModel().shareCompiledData(animatedModel);
}
if (cloneStaticModel) {
tower.setModel(model.cloneObject());
tower.getModel().shareCompiledData(model);
}

return tower;
}
here is part of my code where I add the Object (newTower.getAnimatedModel is the one that flashes brown) :
Code: [Select]
                float levelHeight = ((CreatureDefenseApp) main.getApplication()).getLevelHeight();

Tower newTower = tower.clone(false, true);
newTower.setWorld(main.world);
tile.setTower(newTower);
newTower.setTile(tile);
Object3D clone = newTower.getAnimatedModel();
SimpleVector center = tile.getCenter(levelHeight);
center.z = newTower.getHeightPos();

clone.build();
clone.setOrigin(center);


tile.setEnabled(false);
main.getTowerRunner().add(newTower);

Object3D rangeCircle = newTower.getRangeCircle();
SimpleVector rangeCircleCenter = tile.getCenter(levelHeight);
rangeCircleCenter.z = ((CreatureDefenseApp) main.getApplication()).getLevelHeight() - 0.02f;
rangeCircle.setOrigin(rangeCircleCenter);
rangeCircle.build();

main.world.addObject(clone);
main.world.addObject(rangeCircle);

51
Support / Re: Error can't remove object
« on: July 21, 2011, 11:46:00 am »
I guess its up to you, it might be good to have a better log message for anyone who does it accidentally though so at least they know what they did wrong.

52
Support / Re: Loading Screen
« on: July 21, 2011, 11:23:56 am »
If you have an activity running before you start the game activity (like a main menu) then you can actually do setContentView(ImageView) immediately before the startActivity() of your jpct part.  Then in the main menu activity you want an onRestart() method that does setContentView(MainMenu) back so that it doesn't continue showing the ImageView loading screen.  This is what I am doing.

Also if you don't have a main menu, then perhaps you could make a dummy activity that litteraly just does setContentView(ImageView) then startActivity of your main activity.  Unfortunately, this ImageView method does not support a progress bar though.

53
Support / Out Of Memory error?
« on: July 21, 2011, 03:45:33 am »
Hello According to the MemoryHelper I was only using aroudn 10MB memory after compaction, but somehow I got an OutOfMemory error shown here:
http://i8.photobucket.com/albums/a23/Disastorm/OOM.jpg

How can I prevent this?  It happened when I added a whole bunch of objects into my scene (slowly added 1 at a time, through cloneObject).

*edit I saw in another thread you mentioned something about shareCompiledData.  That looks like it may have solved my OutOfMemory issue.
However it seems to work on all my objects except for my "enemies".  For some reason when I call it on them they become invisible... why is this?
also whats the difference between cloneObject and new Object3D(model, true) ? should i actually use the latter instead of cloneObject?  Also I noticed when I do shareCompiledData, my object flashes like brown for a split second when I add it to the world.  If i dont share the compiled data this does not happen.  Is there a way I can stop this flash of brown as it is a little annoying and makes me feel like my game is less polished.

54
Support / Error can't remove object
« on: July 21, 2011, 03:21:08 am »
Hello, I'm not sure how I got this but I was running my application and I got this can't remove object error:

FATAL EXCEPTION: GLThread 9
RuntimeException ERROR: Can't remove object #218!
at Logger.java:189
at World.removeObject:267
...

*edit I think I may have found what I did wrong, is this the error you get when an object was already removed and you try to remove it again?  I think perhaps my collision listener may have had 2 objects collide at the same time with my object and then what happens is i put my object in a queue to be removed later (during the main thread) so I think maybe it added it twice and tried to remove it twice.  Is this the error I would get in this case?

55
Support / Re: State of OpenGL ES2.0 support
« on: July 20, 2011, 10:31:11 am »
Hello what is the advantage of ES2.0 other than ability to anti alias?  Is it better in terms of performance or memory?  I guess it also allows shaders whereas the 1.1 didn't (I'm just guessing that since you posted a bunch of shader demos)?

56
Support / Re: TextureManager problem?
« on: July 20, 2011, 10:15:42 am »
Thanks actually I just discovered the solution to the texturemanager was that i needed to unload it but keep the texture name in there.  And then instead of adding it back I call replace.  However, you mention that it keeps track of usage itself?  Do you mean I don't need to unload it to free memory?  I was thinking I would have a level and before the level I load all the textures for that level, then after i unload them and load textures for next level.  Is this a good idea?

Also, I think I got rid of the memory leak (not exactly sure how as I tried a bunch of different things including setting all my variables to null and also I think the change I did with unloading and replacing textures also helped).  I still see different values when starting up my level but they seem to bounce between 5MB-7MB range and then back to 5MB so it doesnt seem to be getting any higher.  Not sure why it changes though.  Well when the player exits the game I do plan on disposing the world and then reinitialize everything when they start the game again.  This sounds like the correct approach right?  Honestly, I don't like Android's style where they never actually end a process because it makes things very confusing.  I think I did try to call compress once on a texture but i got some error but I forgot what it was.  If I try that again I'll let you know.

*edit I just did compress and it seems to work for me now, also gives me more memory.  Is it good to just compress every texture?
Also where is this alpha version you mention, should I get that?  I'm just using the regular version from the download site.

57
Support / TextureManager problem?
« on: July 20, 2011, 01:00:32 am »
*edited this post a million times, texturemanager problem is last half of my post.

Hello I'm trying to figure out what to clear from memory on OnStop so that I don't have a memory leak.  Originally i had a big leak its because I wasn't disposing the framebuffer, but now it seems to be smaller.  Right now I am calling removeAndUnload on all the textures, world.dispose, and framebuffer.dispose.  Is there anything else I need to call?  Do i need to call some dispose method on the actual Object3Ds ( I didn't see one)? Also should I be using VBO?  Does that take any more memory than vertex arrays or does it not really matter?

*edit I think I mostly fixed my memory leak issue but maybe you can tell me if this sounds like there is one or not:

First Run after initialization of the world: 11800 KB (after calling MemoryHelper.compact)
second: 12450 KB
third: 12534 KB
fourth: 12547 KB



 However, I just discovered another problem, on my fifth run, the TextureManager said I have too many textures despite the fact that I removeAndUnload them every time.  It said to change Config.maxTextures but in your javadoc it says "The manager wil increase the value if needed. This is in for historical reasons only. No need to adjust it. Default is 64. "  So is something weird happening?

*edit if only add the textures the initial time and do not add them after that, if i keep restarting my app, it eventually crashes with an out of memory error, something about converting the texture in the gl rendering or something.  Can you tell me what I should do about the texture problem because it is crashing my application.  I tried changing Config.maxTextures but that doesn't help. 

Also what does the "used out of" part mean in MemoryHelper.compact()'s log message?

*edit
oh wow i removed a 1MB texture and it freed up 8-9MB of memory? 

58
Support / Re: 2cameras at once/stereoscopic 3d?
« on: July 19, 2011, 03:37:26 am »
Actually that is the camera i was talking about, the one that renders image to the screen.  Is there any way i can use two cameras to render two images to the same screen in different positions?  That way if I have a game I can put two cameras in it, at eye-distance apart, and then that will make my game 3D.  It sounds so easy for such a cool feature.

59
Support / 2cameras at once/stereoscopic 3d?
« on: July 18, 2011, 08:46:24 pm »
Hello, I have a 3d phone (older japanese Sharp phone, not the newer LG or HTC one, so I don't know their apis, but maybe the same) and basically all it requires for 3d is to send a doubled image with the left eye image on the left side and the right eye image on the right side on a single SurfaceView.  I was just wondering If there is a way to do this with jpct? Also would be nice making some 3d apps since there aren't many out there right now.

60
Support / cloning/reusing mesh doing weird stuff?
« on: July 18, 2011, 06:11:01 am »
Hello, I noticed cloning or reusing meshes seems to offset the center of the object or something like that sometimes.  Have you experienced this before?  Also should I call build() after cloning an object?  I've tried both ways, and both ways seem to have strange results.

*edit also noticed clearRotation() clears the scale of my model for some reason.

*edit ok i solved it, i was cloning a non-built object and then calling build after cloning, but i guess maybe thats not the proper thing to do? I added the build before the clone and now it works.  However, just wondering, the only build i need is before the clone or should i also call build after?

Pages: 1 2 3 [4] 5 6 ... 11