Why do I get a blinking screen when running lwjgl?

Posted by SystemNetworks on Game Development See other posts from Game Development or by SystemNetworks
Published on 2012-10-05T06:20:08Z Indexed on 2012/10/05 9:50 UTC
Read the original article Hit count: 201

Filed under:
|
|
|

I didn't have any errors. But When I run my lwjgl game, it gives me a blinking screen. Here is the code:

package L1F3;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.LWJGLException;
import static org.lwjgl.opengl.GL11.*;
public class Main {
    public static void main(String[] args) {


        try {
            Display.setDisplayMode(new DisplayMode(640, 480));
            Display.setTitle("A fresh display!");
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
            Display.destroy();
            System.exit(1);
        }
        while(!Display.isCloseRequested()) {
            Display.update();


        }
        Display.destroy();
        System.exit(0);
    }
}

How do I stop the blinking screen? I was thinking its my framerate. I deleted Display.sync but it still gives me all white and black. Last time it didn't give me a blinking screen.

EDIT

When I remove Display.update() , it gives me a perfect screen, no blinking or no white. Will my game work without it? I can also close it perfectly.

© Game Development or respective owner

Related posts about opengl

Related posts about java