View Full Version : Skewing with a matrix ?

06-13-2003, 05:32 AM

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.


06-13-2003, 10:29 AM
well... you can't http://www.opengl.org/discussion_boards/ubb/smile.gif 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()

06-13-2003, 10:40 AM
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

06-14-2003, 01:35 AM

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