OK thanks for the information! I just looked a bit more at the source and saw
glLoadMatrixf(transform.getMatrix()) in
RenderTarget::applyTransform that's what you meant right?
So just to make sure if I understood everything correct. For every object I have to store my four vertices and a
sf::Transformable (seems to have an easier control than
sf::Transform). Then I apply the transformable to each vertex, push them to the array and draw that array.
So something like this (in the example the texture is 16x16 big):
sf::Vertex vertices[4];
vertices[0].texCoords = sf::Vector2f(0, 0);
vertices[1].texCoords = sf::Vector2f(0, 16);
vertices[2].texCoords = sf::Vector2f(16, 16);
vertices[3].texCoords = sf::Vector2f(16, 0);
sf::Transformable m_transform;
//...
// update
m_transform.rotate(angle);
m_transform.move(x,y);
//...
// render
vertices[0].position = m_transform.getTransform().translatePoint(0, 0);
vertices[1].position = m_transform.getTransform().translatePoint(0, 16);
vertices[2].position = m_transform.getTransform().translatePoint(16, 16);
vertices[3].position = m_transform.getTransform().translatePoint(16, 0);
for(int i = 0; i < 4; i++)
vertexarray.append(vertices[i]);
//...
window.draw(vertexarray);
Does this look right?
Two questions remain: Where do I specify the texture? Will calculating the transformation like this and only draw one vertex array be significantly faster then drawing lots of sf::Sprite's?