SFML community forums

Help => Graphics => Topic started by: The Terminator on May 19, 2013, 03:50:47 am

Title: Need a little bit more info to understand
Post 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
Title: Re: Need a little bit more info to understand
Post by: FRex on May 19, 2013, 04:24:36 am
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.
Title: Re: Need a little bit more info to understand
Post by: Laurent on May 19, 2013, 08:31:24 am
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.