LWJGL 3 does not detect OpenGL

Started by TwisterGE, August 07, 2016, 18:25:52

Previous topic - Next topic

TwisterGE

Hi,

So I recently moved from LWJGL 2.9.3 to LWJGL 3 and I'm getting a pretty annoying error:
[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:
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 :)

spasi

What happens if you skip the glfwWindowHint(GLFW_SAMPLES, 8 ) call?

TwisterGE


spasi

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.

TwisterGE

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

TwisterGE

So I updated my drivers but still nothing. The error is the same...  :-\

abcdef

what width and height are you providing?

TwisterGE

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
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)

spasi

Sounds like you're hitting a known issue with Intel's OpenGL driver. A workaround is suggested in the issue comments.

Quote from: TwisterGE on August 09, 2016, 14:24:33EDIT: 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.

Cornix

Quote from: spasi on August 10, 2016, 08:34:27
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.

TwisterGE

Quote from: spasi 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.

Quote from: TwisterGE on August 09, 2016, 14:24:33EDIT: 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...

CoDi

Quote from: TwisterGE on August 10, 2016, 14:16:00
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.

spasi

Quote from: TwisterGE on August 10, 2016, 14:16:00Should 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:

Quotethe 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.

TwisterGE

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

mtsamis

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