Creating of display doesnt work ...

Started by Trudko, November 06, 2006, 20:37:30

Previous topic - Next topic

Trudko

Creating of display does never work.  The code is very simple so I dont think that I make misstake + I was following the tutorial.

public class BasicOpengl
{

   public static final int  FRAMERATE = 60;
   public static final String GAME_TITLE = "Game";
   public static boolean finished;
   public static float angle;
   
   public static void main(String args[])
   {
       boolean fullscreen = (args.length == 1 && args[0].equals("-fullscreen"));
       
       try {
           init(fullscreen);
         
       } catch (Exception e) {
             e.printStackTrace(System.err);
             Sys.alert(GAME_TITLE, "An error occured and the game will exit.");
       } finally {

       }
         System.exit(0);
   }
   
   private static void init(boolean fullscreen) throws Exception
   {
       Display.setTitle(GAME_TITLE);
       Display.setFullscreen(fullscreen);
       
       Display.setVSyncEnabled(true);
       Display.create();
       while(true)
       {
           Display.update();
       }
       
   }
   
}


darkprophet

Nope, thats fine...

The only reason that it isn't blank is because your not clearing the screen...

Before Display.update(); write the following:

GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);


You have started to get into the nitty gritty of OpenGL, so I would suggest going to nehe and/or looking at the wiki for some tutorials.

Enjoy :)