glfwGetPrimaryMonitor is returning 0

2019-09-19 07:34发布

问题:

If I call

long rslt = glfwGetPrimaryMonitor();

the result is 0. The glfw library can't pick up my monitors for some unknown reason. Also, if I try:

PointerBuffer rslt = glfwGetMonitors();

the result is null... My monitors work fine. I have seen some suggestions that I should uninstall my monitors and let windows reinstall the appropriate drivers. This seems like an inadequate workaround to me. I can't expect users to have to do this if they run my application. I'd much prefer to at least get some error code that I could use to indicate the problem. Has anyone had any experience with this? Is there a way to retrieve a helpful error?

I am running windows 10, lwjgl3, glfw(latest stable build)

回答1:

I gave in and reloaded my monitors. It worked.



回答2:

Do you mean to say you had to re-install your monitor drivers to get it to work?

I'm stuck in the same problem. Calling glfwGetPrimaryMonitor(); from main thread, returns 0, not getting any error messages either...

Edit: Note to anyone who currently struggles with this problem: I recommend getting the newest nightly build of lwjgl as this is a bug in lwjgl 3.0 that hasn't been fixed in any of the stable builds yet (swapping the libs with the newest nightly without taking any other actions solved the problem for me - so this sure is what ultimately caused this)



标签: java 3d lwjgl glfw