Keystone correction in OpenGL

Viewed 19

Is it possible to perform a keystone correction or something like pre-distortion in the vertex shader in openGl. I need to get a kind of trapezoidal output. My current vertex shader code is a simple one :

glPosition = vertexPosition

I read about matrix multiplying the above with a 4x4 distortion matrix to obtain the correct output. In that case what would be the matrix value?

Need an output like below.

enter image description here

0 Answers
Related