DirectX. But it's a matter of preference.
Rotating the rectangles is easy in Direct3D.
1. Simply create your 2 tris to form the quad or rectangle.
2. Call D3DXMatrixTranslation() with the appropriate translation factors.
3. Call D3DXMatrixRotationYawPitchRoll() with the appropriate angles.
4. Concatenate rotation matrix and translation matrix (rotate first or your rotation will be relative to your translation - like a plane orbiting the sun).
5. Set transform to world transform.
6. Set the texture for the object.
7. Setup and needed render states.
8. Draw the primtive.
Here is a sample without the class definition and without the actual vertex setups. This code shows how to load the texture and render the object based on its position and rotation angles.
Code:
<snip>
...
...
void Object::SetTexture(std::string File)
{
if (FAILED(D3DXCreateTextureFromFile(&Device,File.c_str(),Texture)))
{
::MessageBox(0,"Failed to load object texture",0,0);
return;
}
}
void Object::Render(D3DXVECTOR3 CameraPos)
{
//Setup translation matrix
D3DXMATRIX trans;
D3DXMatrixTranslation(&trans,CameraPos.x,CameraPos.y,CameraPos.z);
//Setup rotation matrix
D3DXMATRIX rot;
D3DXMatrixRotationYawPitchRoll(&rot,Rotation.x,Rotation.y,Rotation.z);
//World matrix is concatenation of rotation and translation matrix
D3DXMATRIX world;
world=rot*trans;
//Set Direct3D to use world as transformation matrix for this object
Device->SetTransform(D3DTS_WORLD,&world);
//Set texture for this object
Device->SetTexture(0,Texture);
//Draw the textured quad.
Device->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
}
I leave the rest as an exercise for you. This is an example in 3D. But you can use it for 2D as well. Just assign a constant z value greater than 1.0f (prob greater than 10.0f to make sure they are not z clipped) to all your vertexes. You can also look into using the ID3DXSprite interface.