Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Need a little bit more info to understand  (Read 1740 times)

0 Members and 2 Guests are viewing this topic.

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Need a little bit more info to understand
« 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
Current Projects:
Technoport

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Need a little bit more info to understand
« Reply #1 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.
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Need a little bit more info to understand
« Reply #2 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.
Laurent Gomila - SFML developer

 

anything