Author Topic: Framebuffer shows half black screen during screen rotation  (Read 1095 times)

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Hi Egon,

I have this issue where framebuffer width and height not matching to the screen during screen rotation. The other half of the screen is black. However, it happens only the moment when the screen is rotating. After the screen rotation, the frame buffer starts to dispose and recreate a new one that matches the new screen width and height, and it's fine after that. Is there anyway to fix it so that it looks good during screen rotation?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Framebuffer shows half black screen during screen rotation
« Reply #1 on: April 25, 2014, 06:08:46 pm »
I don't think so. The rotation is done by the Android system and i assume that it simply uses a snapshot of the buffer to do this. I don't see any means to control this behaviour.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Framebuffer shows half black screen during screen rotation
« Reply #2 on: April 25, 2014, 06:19:47 pm »
Previously I tried opengl from the scratch and built a very simple 3d app. I implemented it w/o framebuffer and it looks ok during screen rotation. Can we do that in jpct?
« Last Edit: April 25, 2014, 06:36:39 pm by kkl »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Framebuffer shows half black screen during screen rotation
« Reply #3 on: April 25, 2014, 07:28:15 pm »
jPCT does absolutely nothing in terms of how the screen rotates. It renders into the framebuffer using OpenGL like any other 3d app does. It doesn't care about the context or modifies it in any way. That's totally up to the Activity. The different behaviour might be caused by different loads or whatever but i don't see how one can do anything to change it.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Framebuffer shows half black screen during screen rotation
« Reply #4 on: May 06, 2014, 05:27:02 pm »
It seems to be fixed when i use framebuffer resize(). I guess disposing and recreating a new framebuffer take too long to process and Android cant show the next frame while FBO is disposed during rotation. But to use framebuffer resize(), i have to specified a square size for framebuffer width and height (whichever that is bigger in size). Does it take more memory and reduce performance that way?

I also found out opengl provides rendering to FBO (which JPCT is using, I believe) and rendering to screen directly. Is it doable to just render to screen directly in JPCT instead?
« Last Edit: May 06, 2014, 05:42:40 pm by kkl »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Framebuffer shows half black screen during screen rotation
« Reply #5 on: May 06, 2014, 07:01:40 pm »
I does render to the screen directly (unless you are rendering into a texture). Don't think of the FrameBuffer class as some very complex render wizard or something like that. It's basically a container to store some resolution settings and acts as a holder for the gl renderer and context. It doesn't contain any hidden magic.

Offline kkl

  • float
  • ****
  • Posts: 291
    • View Profile
Re: Framebuffer shows half black screen during screen rotation
« Reply #6 on: May 07, 2014, 03:08:09 am »
That's strange.. It just seems to have that problem when dispose() is used. I'm guessing dispose() flushes the render pipeline and Android couldn't find any frame buffer to display at that moment, IMHO. I guess I'll go with the resize() since it fixes the issue. Thanks ;)
« Last Edit: May 07, 2014, 03:19:37 am by kkl »