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
  Converting (x, y) into NESW direction unknown 19 11,801 Nov 2, 2005 09:52 AM
Last Post: Zekaric
  Converting Int To String Nick 4 14,920 Jun 2, 2005 02:13 AM
Last Post: hangt5
  How to flip window coords maaaaark 3 3,202 May 4, 2005 02:32 PM
Last Post: kelvin
  converting xyz rotation to something else reubert 10 6,774 Mar 5, 2005 07:33 PM
Last Post: Puzzler183
  Converting strings to functions Joseph Duchesne 10 6,316 Feb 23, 2005 11:42 PM
Last Post: Skorche