Do you know what matrix calculations happen inside this function?

Is there a detailed explanation somewhere on the web?

Thanks a lot,


The calculation determines, which section of the normalized device coordinates (-1…1 in all axis) maps to the given subsection of the viewport.
This subsection of the NDC is then strechted and translated so it covers the whole -1…1 range.
In effect you “pick” a subsection of the viewport and “zoom” into it.


I know, but I need to do it manually. I need all the math steps to reproduce it.



here is the direct link to the file (last function):

and this is the opengl sample implementation:
ogl-sample implementation

(probably somewhere in Mesa3d’s source code, too)

Wonderful! Thanks a lot kon, it is exactly what I was looking for!!!