Hi
I'm trying to program a tile-based game in OpenGL. The map consists of quads
which are textured according to their type (water, land, ...).
How do I determine which quad I hit when I pressed the mouse? I tried the
code from NeHe (gluUnproject, article 13 I think), but I can't figure out
how to transform the returned OpenGL coordinates to map coordinates.
The Quads are 1 unit long and wide. I use the z-coordinate for zoom and I
translate the map instead of moving the camera.
Thank you for your help.
|
|
0
|
|
|
|
Reply
|
Tobias
|
3/9/2005 10:22:39 AM |
|
Tobias Langner wrote:
> Hi
>
> I'm trying to program a tile-based game in OpenGL. The map consists of
> quads which are textured according to their type (water, land, ...).
>
> How do I determine which quad I hit when I pressed the mouse? I tried the
> code from NeHe (gluUnproject, article 13 I think), but I can't figure out
> how to transform the returned OpenGL coordinates to map coordinates.
>
> The Quads are 1 unit long and wide. I use the z-coordinate for zoom and I
> translate the map instead of moving the camera.
Do you use isometric view?
How many quads are displayed?
Give example values.
|
|
0
|
|
|
|
Reply
|
Tobias
|
3/11/2005 7:54:25 AM
|
|
>> I'm trying to program a tile-based game in OpenGL. The map consists of
>> quads which are textured according to their type (water, land, ...).
>>
>> How do I determine which quad I hit when I pressed the mouse? I tried the
>> code from NeHe (gluUnproject, article 13 I think), but I can't figure out
>> how to transform the returned OpenGL coordinates to map coordinates.
>>
>> The Quads are 1 unit long and wide. I use the z-coordinate for zoom and I
>> translate the map instead of moving the camera.
>
> Do you use isometric view?
> How many quads are displayed?
> Give example values.
I am at an exprimental stage at the moment. I plan for each map-tile 1 quad
and for each unit/structure 1 quad. I'd like to have at least 100x100 maps
- Units/structures are magnitudes less.
I don't use an isometric view - it's top view.
Zooming is done by changing the camera-angle.
The number of quads displayed depends obviously on the zoom-level - I don't
know if it is useful to show the whole map.
|
|
0
|
|
|
|
Reply
|
Tobias
|
3/13/2005 3:56:23 PM
|
|