first of all, sorry for the bad english.
I need to convert my mouse coordinates to world coordinates, I'm trying to use the glm unproject method. 1280x720 is the size of the window, It's hard coded just for the test. The View and Projection are my matrices, they're fine and are not related to the problem (or so I guess).
EDIT: Success. The solution is:
int x,y; glfwGetMousePos(&x, &y); GLint viewport; glGetIntegerv(GL_VIEWPORT, viewport); y = viewport - y; float depth; glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); mousePos = glm::unProject(vec3(x, y, depth), View, Projection, vec4(viewport, viewport, viewport, viewport));
This method seem to have worked.