Thread: drawing minimaps and radar screens.

  1. #1
    Registered User
    Join Date
    Aug 2001

    drawing minimaps and radar screens.

    Im useing OpenGL.

    I am looking for input on how would be a fast and easy way of setting up a minimap in my game.

    I will probably just use GL_POINTS to draw the locations to it.

    I tried rendering to a texture, and mapping the texture to a poly, that was pitifually slow.

    I have tried drawing the map BG in ortho mode, and drawing the position dots over it, that fell through cause ortho mode screwed my textures up.

    If anyone know how that could happen tell me, No draw code changed, I just added the change to ortho, and the change back after drawing, but everything I would draw had the same texture, and it covered my pointer , even though depth test is off, and my pointer is the last thing drawn.

    Dose anyone have any other methods for doing a minimap?

  2. #2
    Registered User
    Join Date
    Aug 2001

    Perhaps I missunderstood your question, which will make this answer look kinda redicolous, but anyway:

    I figured you are trying to do something similar to the radar used in Counter-Strike.

    To achieve this I would make a bitmap in grayscale, which defines the form of the radar, render this, using blending, to the stencil buffer, in order to mask out the rest of the screen.

    Then place the camera high above the map, and render the "players" as dot's on the radar.

    Guess this could work for you.


  3. #3
    Registered User
    Join Date
    Aug 2001
    Mine is going to be for an RTS game, a minimap but its also going to display radar infromation, LOS circles, etc...

    I think I will just draw primitaves along with my HUD for minimap infromation.

  4. #4
    trade RAM for speed. Don't calculate on the fly, just load a smaller, 2D, grayscale version of your level (top-down), and the clip a rectangle the size of your radar out of it. Whereever player's point of view (POV) moves, grab the correspondingly scaled/positioned chunk off the radar pixmap and display it in the 48x48 radar display block.

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    If you are programming fo 32-bit and using a compiler that supports MMX in inline asm or an assembler that does you could do this very fast.

    I cannot see how that small of a rectangular bitmap on the screen could slow things down that much, even if you did use a transparent effect on it. This is a simple linear interpolation between the pixel that is there and the pixel you want to put there. Using linear interpolation you could get more of the background image if you preferred, or you could get more of the foreground or the super-imposed image.

    short LI(short v1,short v2,double f1)
      short final=0;
      asm {
        fild [v2]               //integer load v2 to st(0)
        fisub [v1]            //integer subtract v1 from st(0)
        fmul [f1]             //float multiply f1 * st(0)
        fiadd [v1]           //integer add v1 to st(0)
        fistp [final]         //integer store in final,pop st(0)
      return final;

Popular pages Recent additions subscribe to a feed
Website Security Test