C++ (Qt)#include <QCoreApplication>#include <QMatrix4x4>#include <QDebug> int main(){ QMatrix4x4 viewportMatrix; viewportMatrix.viewport(0, 0, 100, 100); // {0, 0} is bottomLeft QMatrix4x4 projectionMatrix; // identity QMatrix4x4 modelViewMatrix; modelViewMatrix.rotate(45, 0, 0, 1); const QVector4D vec (1, 0, 0, 1); const QMatrix4x4 modelViewProjectionMatrix = projectionMatrix * modelViewMatrix; const QVector4D modelViewProjectedVec = modelViewProjectionMatrix * vec; qDebug() << modelViewProjectedVec; qDebug() << viewportMatrix * modelViewProjectedVec; return 0;}