Making a radar view

I’m trying to create a radar view. This is a small image rendered like an image label with the special characteristic that it is dynamic and shows small dots where the positions of nearby ships should appear.

I was thinking about doing this with the steps:

A) Load an image A with the radar background.

B) Create a new image B and use image A to paint image Bs background, then draw ship locations on image B.

C) Change the image associated to the image label.

Is this the best way to do this? Is it more efficient to create a small scene and render it to image B and avoid accessing image data directly?

personally, i would probably render it as a separate scene and render to image, but that’s just me.

others might suggest otherwise, as i’m not the most efficient or effective programmer :-/

Why would you go through all the trouble to collapse it into a single image? Just put a background image on a polygon, and make a dot model for each of your little dots. Then parent the “dots” to your background image, and move them around appropriately; and you can spin the whole thing around from the top node.

Let the graphics hardware do its job of rendering what you give it each frame, even if you give it a dozen nodes, each of which is just one dot. No need to try to make it into just one image.

David

uh… radar…

You mean just an onscreenimage (with the radar image)
and a loop that is called each frame which checks the position of all ships and shows for each ship a dot on the screen?

You mean placing a geometry node in aspect2d? The math stuff to do this is a bit hard.

What i wanted to do is to place a quad in the bottom right corner of the screen so that if the screen was 800 x 600 (in screen coordinates with origin at top,left) in rectangle whose diagonal is (740,540) to (790,590). It’s a 50 x 50 pixels rectangle.

This quad would be made of the points (-1,-1), (-1,1), (1,-1), (1,1) with center at (0,0). If this was geom node what would be the transform to make it appear on the right place in the screen?

The radar spots would then be attached as quads (parented) to the radar geom node and the working space to position the radar spots would be from -1 to 1 either x or y axis right?

Download my code for a first person space shooter from the link you can find in the showcase section. I’ve implemented a radar by parenting geometry to aspect2d. Works perfectly fine :wink:

Thanks.
discourse.panda3d.org/viewtopic … sc&start=0