General Question: Double Buffering

Started by JToto, October 17, 2013, 11:33:08

Previous topic - Next topic

JToto

Hey,

First of all: I'm German. Sorry if my english is wrong.


I've got a general question about double buffering using the LWJGL.
Let's say I have to draw a huge Boardgame (or a Map) with x and y Coordinates. For example 500x500 Fields.
If I implement the "Game Loop" that updates/renders the Display I have to iterate over every single field of the board. (To get the single textures of the fields)
That does not make sense when nothing really happened. I simply want to redraw the Display as it was. But when I call Display.update() without clearing the Screen everything is flickering...

I want to have something like this:

public void render() {
       if (this.updated) {
             renderNew(); /* Render new, if anything changed. */
       }
       Display.update();


}

spasi

Try this:

public void render() {
        if (this.updated || Display.isDirty()) {
              renderNew(); /* Render new, if anything changed. */
              Display.update(false); // Swap buffers but don't process messages
        }
        Display.processMessages(); // Always process messages
}

JToto

This works fine!

Thank you very much.
Toto