Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: radar display effect

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2010

    radar display effect

    Need help with a radar display effect create with opengl.
    I need to make something like this :

    How to make this residual effect of the screen?
    To better understand me, watch the video from link below:
    The film is the same effect but did radially.
    I would like to make it circular, a 3D map from a fixed point.
    I could use pixel shaders or interpolation.
    But do not know if this is correct, nor how to implement it.
    Can someone help? Thank you in advance

  2. #2
    Intern Contributor
    Join Date
    Sep 2010

    Re: radar display effect

    I would have done this with a fragment shader that knows the centre of the circle, and from that can calculate the fragments 'angle', which together with a time parameter would decide the colour of the fragment. Or if the fragment is too far away from the centre (outside the circle), it would be discarded.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2008

    Re: radar display effect

    I'll provide two less shader heavy alternatives,

    Create a reasonably high density ring geometry, with an inner radius of 0 ( or near 0 ) and make the rings alpha gradually build from 0.0 to 1.0 as the angle increases, at each point it will end touching the first triangles of the ring which have 0.0. Then simply color ( possibly via sharer ) and render with blending, and and rotate it.

    Create a texture with the radar circle on it that gradually decreases as it goes around, render on a spinning quad with blending.

    Zyx_2000's Quality will probably be highest as each calculation is per fragment, with no quality loss. It might also be slower on older hardware depending on what your target system is that may/may not be important.

    Depending on your geometry density / texture quality my options quality will vary. As 2, will blur at higher resolutions, and 1 might have stepping / less then circular edges.

  4. #4
    Member Regular Contributor
    Join Date
    Mar 2003
    Los Angeles

    Re: radar display effect

    Not quite sure what you're asking for. If just you want an easy way to generate a classic, green, circular, radar, sweep pattern, see the code below. It's a little demo I just whipped up do it. You could probably make even it simpler. But it works. It generates the pattern in the figure below. Hold the 's' key down to rotate it.

    Code :
    //***********************   OpenGL Radar Sweep Pattern    **********************
    //*************************   MaxH - March 21, 2011   **************************
    #include <gl\glut.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    float sw = 0;
    void Keyboard (unsigned char key, int q, int s)
        switch (key)  {
           case 's' :  sw += 3;  glutPostRedisplay();   break;
           case  27 :  exit(0); 
           default  : printf ("   Keyboard %c == %d\n", key, key);
    //-----------------------------  Radar_Pattern  --------------------------------
    void Radar_Pattern (void)
        int i, n = 120;
        float da, ga, gb, a, b;
        const float TWOPI = 3.1415926535 * 2.0;
        da = TWOPI / (float)n;
        glBegin (GL_QUADS);
           for (i = 0; i < n; i++)  {
    	  a = (float)i * da;
    	  b = a + da;
    	  ga = 0.90 * (float)(i  ) / (float)n;
    	  gb = 0.90 * (float)(i+1) / (float)n;
    	  glColor3f  (0, ga, 0);
    	  glVertex2i (0, 0); glVertex2f (cos(a), sin(a));
    	  glColor3f  (0, gb, 0);
              glVertex2f (cos(b), sin(b)); glVertex2i (0, 0);
        glEnd ();
    //--------------------------------  myDisplay  ---------------------------------
    void myDisplay()
        glMatrixMode   (GL_PROJECTION);
        glLoadIdentity ();
        glOrtho        (-2.0,2.0, -1.5,1.5, -1.0,1.0);
        glMatrixMode   (GL_MODELVIEW);
        glLoadIdentity ();
        glClearColor (0, 0, 0, 0);
        glClear (GL_COLOR_BUFFER_BIT);
        glRotatef (sw, 0,0,1);
        Radar_Pattern ();
    //----------------------------------  main  ------------------------------------
    int main (int argc, char **argv)
        printf ("\n   Hold 's' key down to sweep radar pattern.\n");
        glutInit               (&amp;argc, argv);
        glutInitWindowSize     (800, 600);
        glutInitWindowPosition (400, 100);
        glutInitDisplayMode    (GLUT_DEPTH | GLUT_DOUBLE);
        glutCreateWindow ("Radar Pattern - MaxH - March 2011");
        glutDisplayFunc  ( myDisplay );
        glutKeyboardFunc ( Keyboard  );
        glutMainLoop   ();
        return 1;
    Am I doing your homework for you?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts