Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Drawing a ship's icon on a HUD  (Read 2092 times)
Mutos
Community Member
*
Posts: 437


WWW
« on: October 17, 2004, 09:36:43 AM »

Hi all,


I'm working on a small app, that might or not become a space sim game. It's on the Showcase forum, at :

http://www.truevision3d.com/phpBB2/viewtopic.php?t=6441

I've made ships move, rotate and now I've got to make them compute and follow courses. But as they'll go far from one another and my camera is bound on ships, I need to see far away ships. For that I need to draw icons and to do things well, I've decided on a HUD-type system, w/ a ship being surrounded by a target rectangle w/ its name, class and distance to the camera.

But HOW do I do that in TV3D ? I've seen various things about render surfaces, billboards, direct 2D screen drawing, etc... But I've not seen for now anything clear enough to help me choose or get a starting point.

So my question : do anyone know which ways are easy, fast or simply possible for drawing an icon w/ changing figures ?
Logged

@+

Benoît 'Mutos' ROBIN
http://spacesims.hoshikaze.net
Dan
Customers
Community Member
*****
Posts: 707


WWW
« Reply #1 on: October 22, 2004, 06:33:44 AM »

Hi Mutos,

Can't advise on best practice as my experience with HUDs is fairly limited.
I can help try to reduce your confusion over the objects you mentioned.

A Billboard is a surface that always faces the camera and occupies a 3D space, They are great for stuff like lens flare and plants etc.. Because the are in 3D space they have a zorder which means they can appear behind stuff when rendering.

A Rendersurface is only found in memmory. It is doesn't it self get rendered (EDIT: Correction, the scene is a rendersurface that is used to update the screen), however the output can be applied as a texture to other objects (Meshes and billboards). You can fill a rendersurface either by rendering the view from a camera and/or blending textures and/or text etc.. One use for a rendersurface would be to create reflections, the rendersurface is used as a  buffer.

Quote from: "Microsoft website"

Surfaces can be used in a variety of ways including render targets, off-screen rendering, or rendering to textures. An example of off-screen rendering can be seen in the Water Sample.


2D Texturing As far as I'm aware this is the standard way of providing a GUI or HUD. I'm sure you have already found the help on the class in the TVDN. Textures and text can be drawn on to a surface. positions of Mouse clicks need to be checked against 'hotspot' rectangles. It's probably a good idea to consider building a UI class that handles the repentitiveness of this (See links below).

If you were wanting to use billboards then you would also need to create a rendersurface as well as some 2D functions. EG, for each ship icon (billboard) you wanted to render, you would need to:

Code:

  Clear the render surface
  Draw the texture of the ship on to the rendersurface
  Draw any text you wanted to appear on to the rendersurface
  Draw a bounding box on to the rendersurface
  Apply the rendersurface texture to the billboard
  Position the billboard


You could choose not to use the billboards, in which case you would need to:

Code:

  Render the texture of the ship to a known screen position
  Render any text you wanted to appear to a known screen position
  Render a bounding box to a known screen position


Both methods would have advantages / disadvantages. I guess it is whatever best works with the rest of you gui.

Links:

Microsoft explanation of billboarding

Gamedev GUI Tutorial (Part1)
Gamedev GUI Tutorial (Part2)
Gamedev GUI Tutorial (Part3)
Gamedev GUI Tutorial (Part4)
Logged
Mutos
Community Member
*
Posts: 437


WWW
« Reply #2 on: October 22, 2004, 11:16:25 AM »

Hi all, hi Dan,


Thanks a lot for clearing my fuzzy ideas, I'll try the tutos and articles u quoted and I'll be back in some time
Logged

@+

Benoît 'Mutos' ROBIN
http://spacesims.hoshikaze.net
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks