www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: kkl on April 25, 2014, 05:56:41 pm

Title: Framebuffer shows half black screen during screen rotation
Post by: kkl on April 25, 2014, 05:56:41 pm
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?
Title: Re: Framebuffer shows half black screen during screen rotation
Post by: EgonOlsen 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.
Title: Re: Framebuffer shows half black screen during screen rotation
Post by: kkl 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?
Title: Re: Framebuffer shows half black screen during screen rotation
Post by: EgonOlsen 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.
Title: Re: Framebuffer shows half black screen during screen rotation
Post by: kkl 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?
Title: Re: Framebuffer shows half black screen during screen rotation
Post by: EgonOlsen 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.
Title: Re: Framebuffer shows half black screen during screen rotation
Post by: kkl 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 ;)