I intend to do some linear transform in 2D window (screen) space in order to do on-the-fly h-/v-keystone correction. I have all the code ready to calculate the linear distortion matrix from four registered corner points of the projection image. At the moment I choose this approach:
Code:
current_pm = viz.MainWindow.getProjectionMatrix()
current_pm.postMult(distortion_matrix)
viz.MainWindow.setProjectionMatrix(current_pm)
Where distortion_matrix is a 4x4 matrix that leaves the z untouched. The distortion in 2D space works fine but I still get some strange clipping artifacts.
My question: Is there a more elegant way in Vizard to implement this final viewport distortion as a 2D transform only rather than as a distortion of the 3D projection matrix?