Open Des-Nerger opened 1 year ago
I am not understanding what is being asked for here, could you explain exactly what feature you would like to see?
A more detailed explanation from https://www.opengl.org/archives/resources/faq/technical/transformations.htm
What are the pros and cons of using glFrustum() versus gluPerspective()? Why would I want to use one over the other?
glFrustum() and gluPerspective() both produce perspective projection matrices that you can use to transform from eye coordinate space to clip coordinate space. The primary difference between the two is that glFrustum() is more general and allows off-axis projections, while gluPerspective() only produces symmetrical (on-axis) projections. Indeed, you can use glFrustum() to implement gluPerspective(). However, aside from the layering of function calls that is a natural part of the GLU interface, there is no performance advantage to using matrices generated by glFrustum() over gluPerspective().
Since glFrustum() is more general than gluPerspective(), you can use it in cases when gluPerspective() can't be used. Some examples include projection shadows, tiled renderings, and stereo views.
Tiled rendering uses multiple off-axis projections to render different sections of a scene. The results are assembled into one large image array to produce the final image. This is often necessary when the desired dimensions of the final rendering exceed the OpenGL implementation's maximum viewport size.
In a stereo view, two renderings of the same scene are done with the view location slightly shifted. Since the view axis is right between the “eyes”, each view must use a slightly off-axis projection to either side to achieve correct visual results.
Sorry for not expanding the context enough.
A more detailed explanation from https:\/\/www.opengl.org\/...
Yes. It's what I talked about. I haven't found an analogue of glFrustrum
in glam
, found only that of gluPerspective
; which felt unjust. Of course one can construct glFrustum
manually, but I thought glam
is supposed to contain such conveniences by itself.
Further implementation details https://lmb.informatik.uni-freiburg.de/people/reisert/opengl/doc/glFrustum.html.
Also DirectX equivalents https://learn.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-xmmatrixperspectiveoffcenterlh and https://learn.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-xmmatrixperspectiveoffcenterrh.
Since I don't do much graphics programing I'm tagging these as help wanted to see if someone else wants to contribute them
I thought that, not only
Mat4::perspective_{lh,rh{,_gl}}
requires more computation involving the nastymath::tan
, it also doesn't allow us to construct matrices for stereoscopic projection: https://paulbourke.net/stereographics/stereorenderOne could omit
perspective
(if the minimalistic approach were pursued), butfrustum
is an essential and fundamental thing to have for such a math library.