Skip to content Skip to sidebar Skip to footer

Libgdx - The Window Is Not Being Cleaned Every Frame

I am using LibGDX to build a simple game for android (based on flappy bird). It happens that when the bird (actor) moves it keeps the old images on the screen, something like this:

Solution 1:

    //set the background color
    Gdx.gl.glClearColor(0, 0, 0, 0);
    //clear 
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

Add the code above in your render method. What this does is to clear the frames on the screen.


Post a Comment for "Libgdx - The Window Is Not Being Cleaned Every Frame"