Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android libGDX flickering #148

Closed
devemux86 opened this issue Aug 21, 2016 · 16 comments
Closed

Android libGDX flickering #148

devemux86 opened this issue Aug 21, 2016 · 16 comments
Labels
Milestone

Comments

@devemux86
Copy link
Collaborator

devemux86 commented Aug 21, 2016

Android libGDX sometimes flickers and jitters when panning / zooming.

Related to #149.

@devemux86 devemux86 added the bug label Aug 21, 2016
@devemux86
Copy link
Collaborator Author

devemux86 commented Aug 21, 2016

The issue can be more clearly observed if we enable the continuous rendering in GdxMap.create():

Gdx.graphics.setContinuousRendering(true);

@devemux86
Copy link
Collaborator Author

devemux86 commented Aug 21, 2016

Among the various settings of AndroidApplicationConfiguration in MainActivity this seems to help:

cfg.numSamples = 2;

@RootSoft
Copy link

It seems
cfg.numSamples = 2;
is helping a little bit. but the camera is still acting up/weird when panning/zooming/rotating.

What about clearing the screen in your render method?

@Override
    public void render(float delta) {

        if (!mRenderRequest)
            return;

        //clear screen
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        mMapRenderer.onDrawFrame();
    }

This seems to help also, but again the camera is sometimes jittering/flickering.

@devemux86
Copy link
Collaborator Author

devemux86 commented Aug 21, 2016

Which render do you mean, in GdxMap?

Regarding clearing see also #5, where a fix was needed for the desktop.

Side note: we have multiple platforms sharing a common code, so need to be very careful with any change in the core modules, like vtm or vtm-gdx.

@RootSoft
Copy link

Yes, the one in GdxMap. I've been putting all my code in a GdxMapScreen so I can handle different screens on my Game. I don't have any jittery effects anymore, but sometimes the camera (viewport) is acting strange.

@devemux86
Copy link
Collaborator Author

devemux86 commented Aug 21, 2016

Made a quick test with just the clear, the result is the same with flickering.

@RootSoft
Copy link

RootSoft commented Aug 21, 2016

Mhmm yes indeed, thought it was fixed but after a while it started flickering again.
Holding in (touching) the screen without doing anything else, shakes the camera little bot too.

@devemux86 devemux86 changed the title vtm-android-gdx flickering Android libGDX flickering Aug 22, 2016
@devemux86
Copy link
Collaborator Author

@RootSoft on what device(s) do you see the flicker?

Because I'm able to see it on Nexus 9 but not on Samsung Galaxy Tab 4 7.0 LTE (Android 5.1.1).

@RootSoft
Copy link

I'm using an Elephone P9000 (Android 6.0).

devemux86 added a commit that referenced this issue Aug 22, 2016
@devemux86
Copy link
Collaborator Author

I enabled MSAA in example to check it in action.

@RootSoft
Copy link

RootSoft commented Aug 22, 2016

I've uploaded a video showcasing the flicker and camera issue here.

Using the following settings:

AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.stencil = 8;
cfg.numSamples = 2;
Gdx.graphics.setContinuousRendering(false);

As you can see, the tree's are sometimes flickering and not rendering for 1/2 seconds too. Don't know if it's related to this issue.
EDIT: the flickering seems to happen when resuming from a paused state. If i hold the screen, it starts flickering. As soon as I start moving, the flickering stops.

@devemux86
Copy link
Collaborator Author

devemux86 commented Aug 22, 2016

Thanks for the visual feedback, it always helps understanding better.
That's what I saw and with the MSAA not happening anymore.
Here flicker appears on the whole map and trees of course follow.

@devemux86
Copy link
Collaborator Author

devemux86 commented Aug 22, 2016

@RootSoft have you tried desktop libGDX #149, how is the behavior there and on what OS?

@RootSoft
Copy link

I haven't tried it on desktop yet since I haven't configured the LibGDX desktop side yet. I'll notify once I've tried it there

@glensimar
Copy link

Hi Guys! I have this jittering/flickering efects sometimes when i tried to include seamarks to map, and it seems that user the same icon for all seamarks, i use a rendertheme from mapsforge (i don't know if this works) with some changes.. But this happened in version 5.1 or lower.. i android 6 works nice..

@devemux86 devemux86 added this to the 0.10.0 milestone Jan 4, 2018
@devemux86
Copy link
Collaborator Author

devemux86 commented Jan 4, 2018

GdxMap.render has a check to skip renders. If we comment it, then works without flickering (no MSAA needed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants