Shear transformation help

Hi im new to Opengl coding a have a small part of a program which im stuck on.
I am coding using C.
I have a simple asymetric polygonal graphic that i need to display a shear transformation of.

This is my code to display the graphic:


glPushMatrix();
glTranslatef(0,0,0);
Draw_Graphic();
glPopMatrix();

glTranslatef(0,0,0);
^
(i think i need to use this line but i haven’t managed to get it to disply the transformation )

Any help with would be much appreciated.

Thanks

No, glTranslate won’t do a shear for you. You’re going to have to calculate your own and load it via glLoadMatrix or glMultMatrix.

Fortunately, this is very easy and very well documented. Try Googling for “shear matrix faq” or somesuch.

Thankyou for your help.
I think info that i have found relates to 3D graphics. My simple asymetric polygonal graphic is in 2D. Do i still need to use a matrix?
Thanks

Originally posted by Jack99:

I think info that i have found relates to 3D graphics. My simple asymetric polygonal graphic is in 2D. Do i still need to use a matrix?

Yes, if you want OpenGL to apply the shear for you. OpenGL only deals with 4-vectors and 4x4-matrices internally, even if you aren’t using all of the elements. Just ignore the bits involving Z (i.e. leave them as 0).

Incidentally, please try not to start multiple threads for the same question. It tends to end up with multiple people wasting their time giving you the same answer.

cheers,
Mike