## 2D rotation

Hi,
Im writing a small 2D game Engine using SDL and OpenGL.So far its coming good.right now im having a trouble in rotating Images(or textured quads in a more OpenGL context).

first I had a problem of rotating it around its centre rather than origin but with few googling i found a way.but dont know whether its a proper way though.so this code worked for me:

Code :
```int Images::drawImage(float x,float y,int width,int height) {
if(rotateEnabled){
glTranslatef(width/2,height/2,-1.0f);
glRotatef(rotAngle,0.0f,0.0f,1.0f);
glTranslatef(-(width/2),-(height/2),1.0f);
rotAngle+=1;
}
glBindTexture(GL_TEXTURE_2D, m_handler);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

glTexCoord2f( 0.0f, 1.0f ); glVertex3f( x, y+height, 0 );
glTexCoord2f( 1.0f, 1.0f ); glVertex3f( x+width,y+height, 0 );
glTexCoord2f( 1.0f, 0.0f ); glVertex3f( x+width,y, 0 );
glTexCoord2f( 0.0f, 0.0f ); glVertex3f( x,y, 0 );

glEnd();
glDisable (GL_BLEND);
return 0;
}```

and the rotate function is

Code :
```int Images::rotateImage(float angle) {
rotAngle = angle;
rotateEnabled = true;
return 0;
}```

the problem is it is rotating the entire screen (i.e) all the images and sprites as if the screen is rotating.I dont want that.I only want that particular image which is calling the rotate function to rotate. for example only the cannon of the tank should rotate not the entire world.

also please tell me is there any other way to achieve this.thanks in advance!!