SFML community forums
Help => Graphics => Topic started by: The Terminator on May 19, 2013, 03:50:47 am
-
I have some questions about the example of tilemap under the vertex array tutorials. I'm having trouble understanding the difference between the entity's coordinates and it's texture coordinates. Also, was Texture Packer used for the 1 sprite used in the example?
Thanks
-
Position is the in-world position.
Texture coords is the coords that map to that position.
Erm.. that sounds.. ;D
So if you have a quad with positions as follows: 0 0 , 0 10, 10 10, 10 0
and texture positions as: 0 0, 0 100, 100 100, 100 0
then the 100x100 rectangle of texture would map to a 10x10 rectangle on screen.
-
Don't set the texture coordinates: your tiles will be placed correctly in the window, but will all be black.
Don't set the position: your tiles will be correctly textured, but they will all appear at position (0, 0) of the window.
Texture coordinates are the equivalent of the textureRect of sprites.