Framebuffer shows half black screen during screen rotation

Started by kkl, April 25, 2014, 05:56:41 PM

Previous topic - Next topic

kkl

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?

EgonOlsen

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.

kkl

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?

EgonOlsen

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.

kkl

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?

EgonOlsen

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.

kkl

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 ;)