Virtual Photo Gallery (spot lights in jPCT)

Started by zbych, November 19, 2012, 10:23:34 PM

Previous topic - Next topic

zbych

Hello everyone.

I was experimenting with spot lights in GLSL & jPCT and this is small fruit of my experiments - "Virtual Photo Gallery" (wallpaper and application).
There is strange side effect of those experiments - the regular application behaves different than wallpaper service, and it looks like TextureManager is not creating a new instance (IMHO logicaly it should ;) ) when application is reCreated (onCreate was called but TextureManager has it's old data) ??? but I don't want to dig into details of my struggle.

Anyway you can download it:
Link application: https://play.google.com/store/apps/details?id=com.zr.virtual.photo.gallery

Link to wallpaper: https://play.google.com/store/apps/details?id=com.zr.virtual.photo.gallery.wallpaper


EgonOlsen

TextureManager is a singleton. As long as the VM instance exists, the TextureManager does.

zbych

Well I thought it was created per application instance but it looks  it is per application - subtle difference :D

zbych

... or it is instance per application BUT not per activity ???

EgonOlsen


zbych

Dalvik is specific VM, so it looks like singleton is created per Dalvik instance ??? = application ??? but not per activity as I thought.

EgonOlsen

Quote from: zbych on November 19, 2012, 11:27:10 PM
Dalvik is specific VM, so it looks like singleton is created per Dalvik instance ??? = application ??? but not per activity as I thought.
Most likely...but what's the actual problem that you had with that behaviour? All that the TextureManager is storing textures... ???

zbych

My problem was with overlaping initialization. In onSurfaceChanged I was trying to execute it as fast as possible (I wanted to show other view with "loading" screen, but it will not show until the onSurfaceChanged method is executing), thats why the only thing I do here is create FrameBuffer, and start separate thread which, do the rest of initialization.
If I don't set explicity device orientation then when the orientation was changed I have noticed that the initialization was still executed by first activity, and the second instance of activity started its own initalization  :o Because there is no system wide synchronization method both instances started to make changes in one texture manager - I thought that TextureManager was created separately for Activity but I was mistaken.

Finally I set "synchronized" on texture manager object and it solved my problem :)


hamedf_hamedf

Dear Zbych,
i want to write a program like that you do,
a gallery with camera move around it auto and manual.
may i have some code like
1- "non-2^n image assign to board",
2- camera movement
3- or any recommendation about how to make a gallery like yours.

Zbych, i want to give it to my best friend as a gift and is not commercially.