Darkly
Darkly

Reputation: 395

glfwGetVideoMode(glfwGetPrimaryMonitor()) not working

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.

Upvotes: 3

Views: 2509

Answers (1)

Darkly
Darkly

Reputation: 395

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

Upvotes: 8

Related Questions