Hello, all! Just today I was going to try create an LWJGL game, I had some experience with Slick2D, and I thought learning LWJGL as well. would be cool.
But ever since I started trying to make a project from scratch, this is the error I get:
---------------------------
JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
org.lwjgl.LWJGLException: Could not get the JAWT interface
at org.lwjgl.opengl.AWTSurfaceLock.lockAndInitHandle( Native Method)
at org.lwjgl.opengl.AWTSurfaceLock.access$100(AWTSurf aceLock.java:51)
at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLo ck.java:94)
at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLo ck.java:92)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.opengl.AWTSurfaceLock.privilegedLockAndI nitHandle(AWTSurfaceLock.java:92)
at org.lwjgl.opengl.AWTSurfaceLock.lockAndGetHandle(A WTSurfaceLock.java:66)
at org.lwjgl.opengl.MacOSXCanvasPeerInfo.initHandle(M acOSXCanvasPeerInfo.java:57)
at org.lwjgl.opengl.MacOSXDisplayPeerInfo.doLockAndIn itHandle(MacOSXDisplayPeerInfo.java:56)
at org.lwjgl.opengl.PeerInfo.lockAndGetHandle(PeerInf o.java:85)
at org.lwjgl.opengl.MacOSXContextImplementation.creat e(MacOSXContextImplementation.java:47)
at org.lwjgl.opengl.ContextGL.<init>(ContextGL.java:1 32)
at org.lwjgl.opengl.Display.create(Display.java:847)
at org.lwjgl.opengl.Display.create(Display.java:754)
at org.lwjgl.opengl.Display.create(Display.java:736)
at vividmario52.DisplayScreen.start(DisplayScreen.jav a:12)
at vividmario52.CJAF2D.main(CJAF2D.java:9)
---------------------------
I do not exactly understand this error. Perhaps posting code will help you all try and see what this problem is:
Main class:
DisplayScreen class:public class CJAF2D { public static void main(String[] args) { DisplayScreen ds = new DisplayScreen(); ds.start(); //Call the start method from DisplayScreen } }
import org.lwjgl.LWJGLException; import org.lwjgl.opengl.*; public class DisplayScreen { public void start(){ OnscreenRenderer or = new OnscreenRenderer(); try{ Display.setDisplayMode(new DisplayMode(640, 480)); Display.setTitle("CJAF2D"); Display.create(); }catch(LWJGLException e){ e.printStackTrace(); System.exit(0); } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); while(!Display.isCloseRequested()){ or.render(); //Call the render method from the OnscreenRenderer class Display.update(); } Display.destroy(); } }
And finally, the OnscreenRenderer class:
import org.lwjgl.opengl.GL11; public class OnscreenRenderer { public void render(){ //Render onscreen stuff GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); } }
The code doesn't contain any errors, so I'm not sure exactly what's going on.
Help is appreciated!