LibGDX blinking

时光怂恿深爱的人放手 提交于 2019-12-08 08:32:10

问题


I've used the LibGDX UI Setup to start a project.

The only thing I have in the implements ApplicationListener is:

public void create() {      
        setScreen(new LoadingScreen(this));
}

This is supposed to fire the LoadingScreen and it does since I have a print in its constructor and it does show. I have a print in the render method and it's only shown once and I understand this should be printed a lot of times since the render method is called every short period of time.

Here's what I have in the render() method (apart from the print):

OpenGL.glClearColor(1, 0.5f, 1, 1);
OpenGL.glClear(GL10.GL_COLOR_BUFFER_BIT);

Where OpenGL = Gdx.graphics.getGL10();

As I said I think render is only called once and what I see in the screen when I execute the desktop main is an image blinking from pink to black and bars going from top to bottom.


回答1:


Just in case it It helps someone.

The problem was solved by adding to the render method in the Game extending class this:

    public void render() {  
    super.render();
}

Now it does not blink and each screen's render is called over and over as it is supposed to happen.



来源:https://stackoverflow.com/questions/15475422/libgdx-blinking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!