NT4 Problems

Herkules has informed me that the following code generates (on NT4) this error message:

ava.lang.IllegalStateException: Keyboard must be created before you can enable buffering
      at org.lwjgl.input.Keyboard.enableBuffer(Unknown Source)
      at LWJGL.initGL(LWJGL.java:129)
      at LWJGL.init(LWJGL.java:122)
      at LWJGL.start(LWJGL.java:93)
      at BasicGame.main(BasicGame.java:56)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

There’s no error message on my winxp system

Here’s my code:

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.glu.GLU.*;

public final class BasicGame extends LWJGL
{

    /** Some stuff I added for fun **/
      private float translation=0.0f;
      private float velocity=0.02f;
      private float rot=0;
      
      /** Lwjgl constructor.
       */

      public BasicGame()
      {
            super("BasicGame", false);
      }




      /** Rendering method.
       */

      protected final void render()
      {
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            glLoadIdentity();

              // Draw here...
            glTranslatef(-1.5f,0.0f,-6.0f);                              // Move Left 1.5 Units And Into The Screen 6.0

            glRotatef(rot,1.0f,1.0f,0.0f);      
            glBegin(GL_QUADS);                                    // Drawing Using Triangles
                  glColor3f(1.0f,0.0f,0.0f);
                  glVertex3f( 0.0f+translation, 1.0f, 0.0f);                        // Top
                  glColor3f(0.0f,1.0f,0.0f);
                  glVertex3f(-1.0f+translation,-1.0f, 0.0f);                        // Bottom Left
                  glColor3f(0.0f,0.0f,1.0f);
                  glVertex3f( 1.0f+translation,-1.0f, 0.0f);                        // Bottom Right
                  glColor3f(1.0f,1.0f,1.0f);
                  glVertex3f( 1.0f+translation,0.0f, 1.0f);
            glEnd();
            rot+=3.0f;
            translation+=velocity;
            if (translation < 0.0f || translation > 3.0f)
                  velocity=-velocity;
      }

      /** Main method.
       */

      public static void main(String args[])
      {
            (new BasicGame()).start();
      }
}
/* Standard imports.
 */

import org.lwjgl.*;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;

import org.lwjgl.fmod.FMOD;
import org.lwjgl.fmod.FMODException;
import org.lwjgl.fmod.FSound;
import org.lwjgl.fmod.FSoundStream;


/* Static imports.
 */

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.glu.GLU.*;

import static org.lwjgl.fmod.FMOD.*;
import static org.lwjgl.fmod.FSound.*;

public abstract class LWJGL {


        /** Is game finished ? **/
      protected boolean finished;
      
        /** Parameters **/
      protected boolean fullscreen;
      protected String title;

      /** Lwjgl constructor.
       */

      public LWJGL(String title, boolean fullscreen)
      {
            this.title = title;
            this.fullscreen = fullscreen;
            createWindow();
      }

      protected void createWindow()
      {
            try
            {
                  if (fullscreen)
                  {
                        int mode = -1;
                        DisplayMode modes[] = Display.getAvailableDisplayModes();
      
                        for(int i = 0; i < modes.length; i++)
                        {
                              if(modes[i].width == 1024
                                 && modes[i].height == 768
                                 && modes[i].bpp >= 32)
                              {
                                    mode = i;
                                    break;
                              }
                        }
      
                        if(mode != -1)
                        {
                              System.out.println("Setting display mode to " + modes[mode]);
                              Display.setDisplayMode(modes[mode]);
                        }
                        Window.create(title, 32, 0, 0, 0);
                  }
                  else
                        Window.create(title, 0, 0, 800, 600, 32, 0, 8, 0);
            }
            catch(Exception e)
            {
                  System.err.println("Failed to create display/OpenGL mode due to " + e);
                  System.exit(1);
            }
      }


      /** Start OpenGL application.
       */
      
      protected void start()
      {
            try
            {
                  init();

                  while(!finished)
                  {
                        if(Window.isCloseRequested())
                              System.exit(0);

                        process_keyboard();
                        render();
                        Window.update();
                  }   
            }
            catch(Throwable t)
            {
                  t.printStackTrace();
            } 
            finally
            {
                  cleanup();
            }
      }



      /** Init OpenGL and FMOD.
       */

      protected void init() throws Exception
      {
            initGL();
            initFMOD();
      }
 
      protected void initGL() throws Exception
      {
              // Enable keyboard buffer.
            Keyboard.enableBuffer();

              // Go into 3D projection mode.
            glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();
            glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //Background color (r,g,b,alpha)
      }

      protected void initFMOD() {}

      /** Rendering method.
       */

      abstract void render();


      /** Process keyboard events.
       */

      protected void process_keyboard()
      {
            for(int i = 0; i < Keyboard.getNumKeyboardEvents(); i++)
            {
                  Keyboard.next();

                  if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
                        finished = true;
                        
                  if(Keyboard.getEventKey() == Keyboard.KEY_F1 && Keyboard.getEventKeyState())
                  {
                        Window.destroy();
                        fullscreen = !fullscreen;
                        createWindow();
                        try
                        {
                              initGL();
                        }
                        catch (Throwable t)
                        {
                              t.printStackTrace();
                              System.exit(0);
                        }
                  }
            }
      }
 


      /** Cleanup.
       */

      protected void cleanup()
      {
            Keyboard.destroy();
            Window.destroy();

            cleanupFMOD();

            try
            {
                  Display.resetDisplayMode();
            }
            catch(Exception e)
            {
                  e.printStackTrace();
            }
      }
      
      protected void cleanupFMOD() {}
}

Does anyone no what the problem and maybe how to solve it?

It can be found as a web start app at www.projektrandom.frac.dk

You need to do what the error messages says and create the keyboard.

Keyboard.create();


Dave Hunt

…but the Keyboard should be created automatically for you on a Window.create()! :-/

Chuck in a System.out.println(Keyboard.isCreated()) after createWindow() in the LWJGL constructor. Does that return false?

Is LWJGL even supposed to work on NT4? Weren’t there some issues with DirectX?

I think we stopped supporting NT4 (on account of the fact it’s just not for games). Brian might have done a special build for EgonOlsen that works but I don’t have it.

Cas :slight_smile:

Yes, this one works under NT4…at least for me:

http://matzon.dk/brian/lwjgl/builds/lwjgl-2004-05-11.zip

Thanks you guys for your insight and help! Appreciate it!

any gamer use NT4 ? ??? ???

:slight_smile:

Yes! NT4 still works in many companies, and esp. there the casual games should work (who plays casual games at home?)!

But there seems to be another issue.

AlienFlux and SuperElvis work very well with NT4, so it doesn’t seem to be a fundamental LWJGL problem.

LWJGL still supports NT 4, although no testing on that platform is performed, so we’re dependent on you to report bugs on that platform. The direct X issue was resolved, causing the keyboard and mouse to work (requires dx 3), and controller to fail (requires dx 5). Unfortunately, the issues was resolved after 0.9 release, so you’ll need an unofficial build to make it work.

  • elias