Rotate Texture2d using rotation matrix <p>I want to rotate 2d texture in cocos2d-x(opengl es) as i searched i should use rotation matrix as this : </p> <blockquote> <p>(x = cos(deg) * x - sin(deg) * y y = sin(deg) * x + cos(deg) * y)</p> </blockquote> <p>but when i want to implement this formula i fail may code is like(i want original x and y to be same ) : i updated my code to this but still not working!</p> <pre><code> GLfloat coordinates[] = { 0.0f, text-&gt;getMaxS(), text-&gt;getMaxS(),text-&gt;getMaxT(), 0.0f, 0.0f, text-&gt;getMaxS(),0.0f }; glMatrixMode(GL_MODELVIEW); glPushMatrix(); GLfloat vertices[] = { rect.origin.x, rect.origin.y, 1.0f, rect.origin.x + rect.size.width, rect.origin.y, 1.0f, rect.origin.x, rect.origin.y + rect.size.height, 1.0f, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height, 1.0f }; glMultMatrixf(vertices); glTranslatef(p1.x, p1.y, 0.0f); glRotatef(a,0,0,1); glBindTexture(GL_TEXTURE_2D, text-&gt;getName()); glVertexPointer(3, GL_FLOAT, 0, vertices); glTexCoordPointer(2, GL_FLOAT, 0, coordinates); glColor4f( 0, 0, 250, 1); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glRotatef(-a, 0.0f, 0.0f, -1.0f); glPopMatrix(); </code></pre>