Author Topic: Virtual Photo Gallery (spot lights in jPCT)  (Read 2246 times)

Offline zbych

  • int
  • **
  • Posts: 75
    • View Profile
Virtual Photo Gallery (spot lights in jPCT)
« 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

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


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #1 on: November 19, 2012, 10:30:44 pm »
TextureManager is a singleton. As long as the VM instance exists, the TextureManager does.

Offline zbych

  • int
  • **
  • Posts: 75
    • View Profile
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #2 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

Offline zbych

  • int
  • **
  • Posts: 75
    • View Profile
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #3 on: November 19, 2012, 10:56:31 pm »
... or it is instance per application BUT not per activity ???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #4 on: November 19, 2012, 11:00:43 pm »
It's per virtual machine instance.

Offline zbych

  • int
  • **
  • Posts: 75
    • View Profile
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #5 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #6 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... ???

Offline zbych

  • int
  • **
  • Posts: 75
    • View Profile
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #7 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 :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #8 on: November 21, 2012, 08:25:35 pm »
I see.

Offline hamedf_hamedf

  • byte
  • *
  • Posts: 19
    • View Profile
Re: Virtual Photo Gallery (spot lights in jPCT)
« Reply #9 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.