converting graphics to tile coords

Posts: 105
Joined: 2007.03
Post: #1
Okay, so I'm working on a 2d isometric opengl sprite based engine. First off, I use textures quads for sprites (including tiles). Here's some code(it's just an example please don't critique my code) showing how I render tiles.

for (x = 0; x < MAP_WIDTH; x++)
    for (y = 0; y < MAP_HEIGHT; y++)
          // since the tiles are isometric i have to offset them when drawing
          // to get them to display properly
          offset tile (TILE_PIXEL_WIDTH/2)
          offset tile (TILE_PIXEL_HEIGHT/2)

Now what I need to do is to be able to check which pixel(in opengl coordinates) the mouse if on(which is no problem) and then take this pixel and figure out which tile the mouse is on. So basically I need to be able to convert opengl coordinates to my isometric tile coordinates. Anyone have any idea of how I should go about this?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Formula for converting angle to vector? komirad 2 14,572 Jul 29, 2011 07:29 AM
Last Post: ThemsAllTook
  Converting Local to World Coordinates anthony 0 4,508 Jun 25, 2007 03:50 AM
Last Post: anthony
  Converting (x, y) into NESW direction unknown 19 15,372 Nov 2, 2005 09:52 AM
Last Post: Zekaric
  Converting Int To String Nick 4 16,348 Jun 2, 2005 02:13 AM
Last Post: hangt5
  How to flip window coords maaaaark 3 3,961 May 4, 2005 02:32 PM
Last Post: kelvin