0

I have two points that describe line, problem is that i know coordinates of one for orthographic matrix (ie 150x250x0), and coordinates for second for perspective matrix (0.5x0.5x20.0f). I would like to translate orthographic coordinates to perspective so i can draw a line using glsl shader :). How to accomplish this task?

4

1 回答 1

0

您需要将一个顶点移动到其他矩阵空间。例如,让我们将 150x250x0 从正交空间移动到透视空间。为此,您需要通过倒置正交矩阵转换您的顶点。我不知道你用的是什么数学库,也许它已经有矩阵求逆的功能。否则使用此链接中的代码:http ://www.gamedev.net/topic/180189-matrix-inverse/ 。在这一步之后,您的顶点位于世界空间中。

PS:矩阵求逆需要一些大量的计算时间。如果您可以跟踪转换步骤(平移、旋转和缩放),则更简单的方法应该是分别反转这些步骤并在此之后组成一个矩阵。

于 2012-06-05T06:20:09.393 回答