LWJGL Invalid Enum Exception

My game runs perfectly fine on my computer. When I start it on some laptop, and try to do Display.setVsyncEnabled() I get LWJGL Invalid Enum Exception.

What could be causing this absurd error? Is this error in my code?

Worst case scenario is I would go and install Eclipse on that laptop and find out what is causing this error with a lot of trial and error, which I would rather avoid if possible.

It’s interesting. Will you please post the complete error? Did that output any error codes?

Invalid enum means error code 1280 by itself.

I’m starting to hate this… It seems that what I can do on older machines is limited by their hardware. On my machine everything works, but on those machines you get stupid errors that don’t make any sense to you unless you know everything about the API…

Does the same thing happen when you use C++ and OpenGL? Should I just concentrate on newer hardware? I mean, I can’t even debug properly the errors I get on that 4 or 5 year old laptop. I mean, it gives me this stupid error with invalid enum, which make no sense to me…

I’ve got this error once. Its because of outdated drivers or incapable hardware. What GPU does it use and what driver version?

I’m pretty sure setVSyncEnabled() cannot cause an OpenGL error. Code?

How am I supposed to show you the code? What code? I mean, do I upload my game source or something? What kind of code do you want? VBO? Shaders? Something else?

Here you go help yourselves. I got the exception on my other very old laptop as well. Not only it seems that this very old laptop doesn’t support anything that is useful shader wise, but it also has this stupid bug with throwing enum exception when switching vsync. I can get around dynamic indexing with huge pieces of code (maybe, i hope), but I have literally no idea how to fix that vsync bug. Anyway, here is the error I get.


org.lwjgl.opengl.OpenGLException: Invalid enum (1280)
        at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
        at org.lwjgl.opengl.WindowsContextImplementation.setSwapInterval(Windows
ContextImplementation.java:113)
        at org.lwjgl.opengl.ContextGL.setSwapInterval(ContextGL.java:232)
        at org.lwjgl.opengl.DrawableGL.setSwapInterval(DrawableGL.java:86)
        at org.lwjgl.opengl.Display.setSwapInterval(Display.java:1129)
        at org.lwjgl.opengl.Display.setVSyncEnabled(Display.java:1142)
        at com.cig.survival.menu.OptionsMenu$1$1.doAction(OptionsMenu.java:22)
        at com.cig.survival.Game.tick(Game.java:264)
        at com.cig.survival.WildernessToHome.loop(WildernessToHome.java:75)
        at com.cig.survival.WildernessToHome.start(WildernessToHome.java:47)
        at com.cig.survival.WildernessToHome.main(WildernessToHome.java:182)
        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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)

OK it would seem that I have found the problem. When I start my game, somewhere in that process, 1280 occurs. Since I’m not doing glGetError, it stays there. When doing Display.setVsyncEnabled(), it seems to do glGetError() in the stack trace, so I would assume that it throws an error that it isn’t supposed to. I mean, there should be notes left or something for developers of such pitfalls. Something like ‘must read’ or something. It was my codes fault, but it only happened, because of kinda faulty design that could at least warn you of such pit falls…

That was exactly my point. Try enabling debug mode and set a debug callback.

(Sorry to reply to a dead thread, I just got this error)

I put a breakpoint on setVSyncEnabled, copied the stack, and got this;

Exception in thread "main" org.lwjgl.opengl.OpenGLException: Invalid enum (1280)
	at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
	at org.lwjgl.opengl.WindowsContextImplementation.setSwapInterval(WindowsContextImplementation.java:113)
	at org.lwjgl.opengl.ContextGL.setSwapInterval(ContextGL.java:232)
	at org.lwjgl.opengl.DrawableGL.setSwapInterval(DrawableGL.java:86)
	at org.lwjgl.opengl.Display.setSwapInterval(Display.java:1129)
	at org.lwjgl.opengl.Display.setVSyncEnabled(Display.java:1142)
	at passage.blu.Engine.create(Engine.java:51)
	at passage.blu.test.MyGame.main(MyGame.java:46)

I also did some research, and found that it meant that my driver faked having something supported. I have a GeForce GTX 650ti, with the latest drivers. It worked before in other settings too.