PDA

View Full Version : how to prevent texture skewness while scaling and rotating



charakalmast
04-06-2013, 05:38 PM
Hi everyone
I have just started learning opengl es 2.0. This is my code for setting it up to draw. The problem i am facing is that when i rotate some rectangle, the image gets skewed. the height and width of the texture i am using changes. Can someone tell me what i am doing wrong?


glViewport(0,0, (GLint)screenWidth, (GLint)screenHeight);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrthof(-1,1,-1,1,-1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glPushMatrix();

glTranslatef(positionX, positionY,0.0f);

glScalef( -scaleX , -scaleY ,1);

glRotatef(rotationZ, 0.0f, 0.0f, 1.0f);