[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: opengl question
On Wed, 27 Oct 1999 firstname.lastname@example.org wrote:
>the idea is to make a good version of the mediocre warhammer 40k games
>that have been produced. i am thinking of something that has myth-like
>graphics, but turn based.
Sounds interesting, but don't start with a too ambitious design. Start
small and later add features.
>so my question is this. if i wanted to tell a particular "troop" on the
>level map to go to another position on the level map, how do i correspond
>the mouse click to a position on the potentially translated and rotated
>level map? i know there is this concept of selection in opengl, is this
>the way to go? is this fast enough not to be too cumbersome? or should
>i do the level map in a completely other way to accomidate for this type
>of play better (i.e., don't use an nxn array level map, but something
I would do it with selection. I'd normally render the terrain as a number
of triangle strips to maximize speed, but have several strips so that
unnecessary ones can be easily culled using some kind of culling
mechanism. For selection I'd then instead render the triangles separately
and give each triangle a unique id (as you do with selection). Same kinds
of culling could be used here. For fast selection you can leave out
everything that is not needed, such as textures, blending, materials,
lights, fog etc, and just render the raw triangles and transformations.
The 'extra stuff' is not needed for selection. OpenGL will then give you a
list of all the id:s that are under the given point. You can then from
that list see what triangle is the closest one (if severla triangles are
udner the cursor due to heights or similar) and somehow find out based on
the id what coordinate was clicked.
That's how _I_ would do it. It works at least, as I've tried it in some
applications. Those who know OpenGL better than I do probably have better
methods of doing it. :-)
Jan 'Chakie' Ekholm | CS at Åbo Akademi University, Turku, Finland
Linux Inside | I'm the blue screen of death, no-one hears you scream