Skip to main content
deleted 20 characters in body
Source Link
Engineer
  • 30.4k
  • 4
  • 76
  • 124

Convert in-hex coordinates to screen space and work therein, as that is the common pixel space.

To know where your pixel-in-a-hex is in screen space, just get the hex's offset (which I presume you have specified?) from top left (or bottom left in OpenGL) of the screen, then get your pixel offset into the hex (multiplying by scale if you are zoomed out or in - i.e. not rendering at 1:1 scale), and add them. That gives you your screen-space co-ords.

To go back to hex space from screen space, reverse the process: Subtract the hex's offset from the coordinates, and divide by scale (or just ignore it).

Convert in-hex coordinates to screen space and work therein, as that is the common pixel space.

To know where your pixel-in-a-hex is in screen space, just get the hex's offset (which I presume you have specified?) from top left (or bottom left in OpenGL) of the screen, then get your pixel offset into the hex (multiplying by scale if you are zoomed out or in - i.e. not rendering at 1:1 scale), and add them. That gives you your screen-space co-ords.

To go back to hex space, reverse the process: Subtract the hex's offset from the coordinates, and divide by scale (or just ignore it).

Convert in-hex coordinates to screen space and work therein, as that is the common pixel space.

To know where your pixel-in-a-hex is in screen space, just get the hex's offset (which I presume you have specified?) from top left (or bottom left in OpenGL) of the screen, then get your pixel offset into the hex (multiplying by scale if you are zoomed out or in - i.e. not rendering at 1:1 scale), and add them. That gives you your screen-space co-ords.

To go back to hex space from screen space, reverse the process: Subtract the hex's offset from the coordinates, and divide by scale.

Source Link
Engineer
  • 30.4k
  • 4
  • 76
  • 124

Convert in-hex coordinates to screen space and work therein, as that is the common pixel space.

To know where your pixel-in-a-hex is in screen space, just get the hex's offset (which I presume you have specified?) from top left (or bottom left in OpenGL) of the screen, then get your pixel offset into the hex (multiplying by scale if you are zoomed out or in - i.e. not rendering at 1:1 scale), and add them. That gives you your screen-space co-ords.

To go back to hex space, reverse the process: Subtract the hex's offset from the coordinates, and divide by scale (or just ignore it).