The viewport is transmitted as four floats: the x and y coordinates of the viewport, followed by its width and height. The same order that is used, for example, on glGetFloatv(GL_VIEWPORT, ...) . Therefore, in most cases, the first two values should be 0.
As KillianDS has already pointed out, the model argument is actually the model view matrix, see the example of using unProject() in gtx_simd_mat4.cpp , function test_compute_gtx() :
glm::mat4 E = glm::translate(D, glm::vec3(1.4f, 1.2f, 1.1f)); glm::mat4 F = glm::perspective(i, 1.5f, 0.1f, 1000.f); glm::mat4 G = glm::inverse(F * E); glm::vec3 H = glm::unProject(glm::vec3(i), G, F, E[3]);
As you can see, the matrix passed as the second argument is basically a translation and a perspective transformation.
source share