Hello Guest

LWJGL 3 does not detect OpenGL

  • 14 Replies
  • 18455 Views
LWJGL 3 does not detect OpenGL
« on: August 07, 2016, 18:25:52 »
Hi,

So I recently moved from LWJGL 2.9.3 to LWJGL 3 and I'm getting a pretty annoying error:
Code: [Select]
[LWJGL] GLFW_API_UNAVAILABLE error
Description : WGL: The driver does not appear to support OpenGL
Stacktrace  :
    org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:1484)
    org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1637)
    com.genesis2d.graphics.Window.create(Window.java:88)
    com.genesis2d.core.Engine.run(Engine.java:49)
    java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-0" java.lang.RuntimeException: Failed to create window
    at com.genesis2d.graphics.Window.create(Window.java:90)
    at com.genesis2d.core.Engine.run(Engine.java:49)
    at java.lang.Thread.run(Unknown Source)
I know this same issue has been reported here, but most of the posts didn't help me because the solution was a simple driver update. That's not the case here.

My GC does support OpenGL (3.1), the drivers are updated (at least Windows says they are), and the same code worked for LWJGL 2.9.3.

As you can see it's Intel HD Graphics 2000, but It actually has a pretty decent performance with modern OpenGL.

This is the window creation code:
Code: [Select]
if (!glfwInit()) {
throw new IllegalStateException("Unable to initialize GLFW");
}

glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_SAMPLES, 8);
   
glfwWindowHint(GLFW_RED_BITS, 8);
glfwWindowHint(GLFW_GREEN_BITS, 8);
glfwWindowHint(GLFW_BLUE_BITS, 8);
glfwWindowHint(GLFW_ALPHA_BITS, 8);

window = glfwCreateWindow(width, height, title, 0, 0);
if (window == 0) {
throw new RuntimeException("Failed to create window");
}

glfwMakeContextCurrent(window);
GL.createCapabilities();

glfwShowWindow(window);
I've made some tests with C++ and GLFW and the same code works flawlessly...

Thanks for your help in advance :)
« Last Edit: August 07, 2016, 18:34:39 by TwisterGE »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 3 does not detect OpenGL
« Reply #1 on: August 07, 2016, 18:28:49 »
What happens if you skip the glfwWindowHint(GLFW_SAMPLES, 8 ) call?
« Last Edit: August 07, 2016, 19:00:22 by spasi »

Re: LWJGL 3 does not detect OpenGL
« Reply #2 on: August 07, 2016, 18:35:59 »
Nothing. Just the same error :/

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 3 does not detect OpenGL
« Reply #3 on: August 07, 2016, 19:05:04 »
The "WGL: The driver does not appear to support OpenGL" error is triggered after the pixel format enumeration code in GLFW. It means that no supported format was found. Try removing the bit hints as well.

Re: LWJGL 3 does not detect OpenGL
« Reply #4 on: August 07, 2016, 19:19:59 »
I removed the bit hints but the error persists. I'm not sure if I should try to update my video drivers, the Intel Updater doesn't give me a new version of it and Windows says the "latest" is installed.
I remember experimenting with LWGL 3 on an old laptop (Intel HD Graphics too), the OpenGL version was 2.1

Re: LWJGL 3 does not detect OpenGL
« Reply #5 on: August 08, 2016, 17:43:58 »
So I updated my drivers but still nothing. The error is the same...  :-\

*

Offline abcdef

  • ****
  • 336
Re: LWJGL 3 does not detect OpenGL
« Reply #6 on: August 09, 2016, 08:23:51 »
what width and height are you providing?

Re: LWJGL 3 does not detect OpenGL
« Reply #7 on: August 09, 2016, 14:24:33 »
640x480
EDIT: Seriously, nothing? It's been 2 days almost, I have an entire code base that doesn't work, Is this a bug? I don't want to rewrite everything in C++ using pure GLFW (the plus side is that that would work)

EDIT2: Detailed error
Code: [Select]
C:\Users\TwisterGE\Desktop\Genesis2Ddemo>java -jar -Djava.library.path="natives/" -Dorg.lwjgl.util.Debug=true game.jar
[LWJGL] Version: 3.0.0 build 90
[LWJGL]          OS: Windows 10 v10.0
[LWJGL]         JRE: 1.8.0_101 amd64
[LWJGL]         JVM: Java HotSpot(TM) 64-Bit Server VM v25.101-b13 by Oracle Corporation
[LWJGL] Loading library (system): lwjgl
[LWJGL]         Loaded from java.library.path: natives\lwjgl.dll
[LWJGL] ThreadLocalUtil state: UnsafeState
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] Loading library: glfw
[LWJGL]         Loaded from java.library.path: natives\glfw.dll
[LWJGL] GLFW_API_UNAVAILABLE error
        Description : WGL: The driver does not appear to support OpenGL
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:1484)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1637)
                com.genesis2d.core.Window.create(Window.java:60)
                com.genesis2d.core.GenesisEngine.run(GenesisEngine.java:52)
                java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-0" java.lang.RuntimeException: Failed to create window
        at com.genesis2d.core.Window.create(Window.java:62)
        at com.genesis2d.core.GenesisEngine.run(GenesisEngine.java:52)
        at java.lang.Thread.run(Unknown Source)
« Last Edit: August 09, 2016, 17:02:57 by TwisterGE »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 3 does not detect OpenGL
« Reply #8 on: August 10, 2016, 08:34:27 »
Sounds like you're hitting a known issue with Intel's OpenGL driver. A workaround is suggested in the issue comments.

EDIT: Seriously, nothing? It's been 2 days almost, I have an entire code base that doesn't work, Is this a bug? I don't want to rewrite everything in C++ using pure GLFW (the plus side is that that would work)

This is the reality of open source software. You may get a quick reply or it might take weeks, you never know. The maintainers are real people with real lives, even if we try our best, sometimes it's impossible to respond fast enough.

FWIW in this case, I came back from JCrete a few days ago and had a lot of catching up to do at work. Also, I was all day in bed yesterday with fever.

*

Offline Cornix

  • *****
  • 488
Re: LWJGL 3 does not detect OpenGL
« Reply #9 on: August 10, 2016, 13:56:26 »
This is the reality of open source software. You may get a quick reply or it might take weeks, you never know. The maintainers are real people with real lives, even if we try our best, sometimes it's impossible to respond fast enough.

FWIW in this case, I came back from JCrete a few days ago and had a lot of catching up to do at work. Also, I was all day in bed yesterday with fever.
I really need to say this right now: Spasi is probably the most active and helpful developer of open source software I have ever seen. He seems to be working 24/7 on LWJGL and is always there to help people out with their problems. More importantly he always finds a solution eventually. I can not emphasize enough how much he deserves praise for his incredible work here.

Re: LWJGL 3 does not detect OpenGL
« Reply #10 on: August 10, 2016, 14:16:00 »
Sounds like you're hitting a known issue with Intel's OpenGL driver. A workaround is suggested in the issue comments.

EDIT: Seriously, nothing? It's been 2 days almost, I have an entire code base that doesn't work, Is this a bug? I don't want to rewrite everything in C++ using pure GLFW (the plus side is that that would work)

This is the reality of open source software. You may get a quick reply or it might take weeks, you never know. The maintainers are real people with real lives, even if we try our best, sometimes it's impossible to respond fast enough.

FWIW in this case, I came back from JCrete a few days ago and had a lot of catching up to do at work. Also, I was all day in bed yesterday with fever.

I'm so sorry. I was very impatient because I've been working in this project for quite a long time. I will be more patient. (Hey I have a real life too :P)
I would downgrade back to LWGL 2.9.3, but t doesn't work in JRE 1.8

Should I open an Issue in GitHub? This seems like a problem with Intel cards...
« Last Edit: August 10, 2016, 14:19:40 by TwisterGE »

*

Offline CoDi

  • *
  • 49
Re: LWJGL 3 does not detect OpenGL
« Reply #11 on: August 10, 2016, 14:50:15 »
This seems like a problem with Intel cards...

Did you check if e.g. some of the LWJGL3 demos work?

Also, you do not set GLFW_CONTEXT_VERSION_MAJOR / GLFW_CONTEXT_VERSION_MINOR. According to the GLFW source code they default to GL 1.0, which isn't of much use anyway.

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 3 does not detect OpenGL
« Reply #12 on: August 10, 2016, 15:18:05 »
Should I open an Issue in GitHub? This seems like a problem with Intel cards...

Did you read the issue comments? Specifically this reply and the ones after it. Also, there's a response from Intel:

Quote
the GPUs this affects are no longer supported. No driver releases are planned that support HD2000/3000. Sorry I can't be of more help.

The workaround is to remove Win10 support from the java executable's manifest.

Re: LWJGL 3 does not detect OpenGL
« Reply #13 on: August 10, 2016, 16:02:06 »
Ugh that's nasty... :S
That explains a lot of things, I've had a similar issue with libGDX...

(Intel is such an a-hole about it >:()

I'm not too expert to do this workaround so... yeah, I'll have to rewrite my project in C++ or JS+WebGL
« Last Edit: August 10, 2016, 16:06:15 by TwisterGE »

Re: LWJGL 3 does not detect OpenGL
« Reply #14 on: August 29, 2016, 18:57:49 »
Hey, I've had some similar issues so let me tell you a workaround for it. The problem I had (using LWJGL 2.9.3, but the problem persisted with LWJGL 3 too) was that when the target PC had windows 10 + Intel HD graphics card they would most of the times get a "PixelFormatNotAccelaratedException". I'm using lwjgl 2.9.3 in a game i made, and multiple users reported this problem. After some time i found out that jre version 8u45 (or below) made the program work correctly and not exception was thrown. Of course you cannot demand users to use such a version, so for me a bundled jre for my java program worked fine.

So if anyone has similar win10 + intelHD problems with lwjgl, and the +150mb of the bundled jre are not an issue (+50mb compressed), you can bundle jre 8u45 with your jar in an .exe that works. Worked very good for me whatsoever