Skewing with a matrix ?


I am a beginning opengl’r

I need to skew an object in the x.
IE the height*a factor get subtracted from the x…

How do I do this with a matrix ?

Any help greatly appreciated.


well… you can’t the easiest way (I think) is to do this for each vertex’s coordinates separately. Think: You would have to do glTraslatef() for each vertex, not mentioning it’s impossible to do anything with matrix between glBegin() and glEnd()

It sounds like you might be able to use a shear matrix. A shear matrix that does something like you’re describing might look like this:

1 0 0 0
n 1 0 0
0 0 1 0
0 0 0 1


Thanks, that was exactly what I needed.
Simple too.
Need to pick up a guide on matrices.