glfwGetVideoMode(glfwGetPrimaryMonitor()) not working

≯℡__Kan透↙ 提交于 2019-12-24 00:38:07

问题


So i was watching a tutorial for java on how to create a window using Lwjgl and i got to this part where you get the primary monitor:

    ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    glfwSetWindowPos(
            window,
            (GLFWVidMode.width(vidmode) - width) / 2,
            (GLFWVidMode.height(vidmode) - height) / 2
        ); 

However i get this error on eclipse : "Type mismatch: cannot convert from GLFWVidMode to ByteBuffer"

which results in this not being allowed: GLFWVidMode.width GLFWVidMode.height (it says: "The method height() in the type GLFWVidMode is not applicable for the arguments (ByteBuffer)")

I have searched for another tutorial and it also uses the methods in that order so I'm not sure what should i replace for it to work or if they updated something in Lwjgl 3.0.


回答1:


Never mind, i checked the source site and it appears that in fact they changed it so it's now this:

GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

    glfwSetWindowPos(
            window,
             (vidmode.width() - width) / 2,
            (vidmode.height() - height) / 2
        ); 


来源:https://stackoverflow.com/questions/34211489/glfwgetvideomodeglfwgetprimarymonitor-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!