Hello Guest

basic DisplayExample with flickering black and white stripes

  • 1 Replies
  • 8396 Views
Hi all, I just installed lwjgl 2.9.0 according to site instructions. i copied the basic DisplayExample Demo from the lwjgl site and get no compile errors. I run the code and i get a window of the requested size but the content is a flickering set of black and white horizontal stripes. No runtime exceptions are reported. when i comment out rendering at line Display.update(); then the flickering stops. anything wrong in the way i followed the instructions or are instructions wrong? i am using eclipse on mac os 10.8.4. any suggestion greatly appreciated. thanks,

Re: basic DisplayExample with flickering black and white stripes
« Reply #1 on: June 25, 2013, 13:55:54 »
found at least a fix for the DisplayExample from NinjaCave. The code needs to clear the screen and depth buffer before rendering. I am including the fixed demo below.

import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;

public class DisplayExample {
   public void start() {
      try {
         Display.setDisplayMode(new DisplayMode(800,600));
         Display.create();
      } catch (LWJGLException e) {
         e.printStackTrace();
         System.exit(0);
      }
      
      // Clear the screen and depth buffer
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

      // init OpenGL here
      while (!Display.isCloseRequested()) {

         // render OpenGL here
         Display.update();
      }

      Display.destroy();
   }
   public static void main(String[] argv) {
      DisplayExample displayExample = new DisplayExample();
      displayExample.start();
   }
}
« Last Edit: June 25, 2013, 13:58:52 by lobsterman »