I’ve been dealing with OpenGL for a while now, but have stuck with orthographic projection since mine is really a 2d app. So now I find that I never really ‘got’ the matrix system, just stuck with simple transforms. Even when I try to set perspective projection, then transform back to the correct view size, I seem to undo the perspective. I’m going to add perspective back in so that a quad looks right when rotated, but need to keep the ‘perfect’ orthographic result when it’s flat.
But now I look at what I need to do in a vertex shader, it starts to look a little clearer. Basically every vertex just gets multiplied by a 4d matrix, right?
So, here’s what I need to work out. What matrix will keep all the items on one plane - lets say z=vpZ, untouched and apply perspective to other values. The best example would be a 1920 x 1080 viewport (and 1920x1080 view), then I’ll draw a 1920 x 1080 at vpZ, centered on the x and y axes. I need the texels to exactly match the screen pixels.
How would I work out the matrix I need? Is that a projection matrix, then I use the ModelView matrix as normal?