0
我被問到某人爲什麼今天在透視投影矩陣上應用以下未知矩陣。但我不知道它是什麼。所以我把這些代碼片段放在這裏來幫助。先謝謝你。在透視投影矩陣上應用一些其他矩陣(偏差或未知矩陣)
{
QRectF rect = boundingRect().translated(pos());
float width = float(painter->device()->width());
float height = float(painter->device()->height());
float left = 2.0f * float(rect.left())/width - 1.0f;
float right = 2.0f * float(rect.right())/width - 1.0f;
float top = 1.0f - 2.0f * float(rect.top())/height;
float bottom = 1.0f - 2.0f * float(rect.bottom())/height;
float moveToRectMatrix[] = {
0.5f * (right - left), 0.0f, 0.0f, 0.0f,
0.0f, 0.5f * (bottom - top), 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.5f * (right + left), 0.5f * (bottom + top), 0.0f, 1.0f
}; //here,what's the matrix meaning for, can i ignore it.
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadMatrixf(moveToRectMatrix);
gluPerspective(60.0, 1.0, 0.01, 10.0);
glMatrixMode(GL_MODELVIEW);
.............................................
moveToRectMatrix在應用透視投影矩陣之前被加載到投影矩陣堆棧中,矩陣代表什麼?謝謝。