www.jpct.net

jPCT-AE - a 3d engine for Android => Projects => Topic started by: zbych on November 19, 2012, 10:23:34 pm

Title: Virtual Photo Gallery (spot lights in jPCT)
Post by: zbych on November 19, 2012, 10:23:34 pm
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 (http://"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 (http://"https://play.google.com/store/apps/details?id=com.zr.virtual.photo.gallery.wallpaper")

(https://lh6.ggpht.com/IpFUxlz5KemZSVgp4NX0H2AFINoJz3WBkOsuiXn6PsNGByT_s_kRoLwUlKLC1e4BGK8=h230) (https://lh6.ggpht.com/pdozbT8fex48xwQvKMSQMJaq83zFJ8YHy2IBknbHF5gga3JFe05m3cbfoAcgAd1OLXc=h230)
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: EgonOlsen on November 19, 2012, 10:30:44 pm
TextureManager is a singleton. As long as the VM instance exists, the TextureManager does.
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: zbych on November 19, 2012, 10:51:54 pm
Well I thought it was created per application instance but it looks  it is per application - subtle difference :D
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: zbych on November 19, 2012, 10:56:31 pm
... or it is instance per application BUT not per activity ???
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: EgonOlsen on November 19, 2012, 11:00:43 pm
It's per virtual machine instance.
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: 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.
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: EgonOlsen on November 20, 2012, 11:16:52 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... ???
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: zbych on November 21, 2012, 07:16:42 pm
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 :)
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: EgonOlsen on November 21, 2012, 08:25:35 pm
I see.
Title: Re: Virtual Photo Gallery (spot lights in jPCT)
Post by: hamedf_hamedf on December 08, 2012, 08:24:15 am
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.