LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.82k stars 640 forks source link

No current context on Win 11 openGL #710

Closed zeduras closed 2 years ago

zeduras commented 2 years ago

Version

3.3.0 (nightly)

Platform

Windows x64

JDK

jdk-17.0.1 jre1.8.0_311

Module

OpenGL

Bug description

Hi there;

I'm just getting started with java and lwjgl, and I wrote the code of the page to get started. But there is problem in (Windows 11 pro)

When I run the program it exits with error, there is no context. I searched a lot and they all pointing you have to make a window then run GL.createCapabilities(); before you draw !!

But the code is alright, and I think the problem is with the openGL driver.

I have to gpu, intel 4000 and amd radeon hd 8730M

I added this part of code for my program

GL.createCapabilities();
GLCapabilities caps = GL.getCapabilities();
System.out.println(caps.OpenGL11);
System.out.println(caps.OpenGL20);
System.out.println(caps.OpenGL21);
System.out.println(caps.OpenGL32);
System.out.println(caps.OpenGL40);
System.out.println(caps.OpenGL43);
System.out.println(caps.OpenGL44);
System.out.println(caps.OpenGL45);
System.out.println(caps.OpenGL46);

I run it on windows and I got all of them false. Why, I'm not sure. I downloaded opengl ext viewer to check my opengl version. And it works just for the intel one. amd doesn't appear.

So, I go to linux and checked it again, I got these results : For AMD true true true true true true true true false For Intel true true true false false false false false false

Is it just a problem with the Windows 11, but I used it in many 3d softwares like: blender 2.83, Keyshot 4, Unity 2021, Godot 3.2, MagicaVoxel 0.99

Stacktrace or crash log output

No response

Spasi commented 2 years ago

Hey @zeduras,

An OpenGL context must actually be current in the current thread, before a call to GL.createCapabilities(). With GLFW for example, you'd need to call glfwMakeContextCurrent(window);.

zeduras commented 2 years ago

Hi @Spasi, thanks to replay

But yeah I know this, and no wrong in the code because it's the code in this page https://www.lwjgl.org/guide

I just added these lines to debug, and I relaized it doesn't detect any opengl In windows 11 But in linux it works without any problems

So, I don't know where is the problem.

zeduras commented 2 years ago

Hi everybody, I searched a lot and I got one,

I downloaded jdk 1.8 which is 8u202

And it worked