Re: OpenGL overlays and performer

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie (dorbie++at++bitch.reading.sgi.com)
Thu, 2 Nov 1995 16:43:31 +0100


On Nov 1, 5:50pm, dheskamp++at++ldsa.com wrote:
> Subject: OpenGL overlays and performer
> Hello:
>
> O.K. I have read the answer to the question: "How do I overlay Graphics
> onto my Performer screen?" Still... I have had no success. For my
> application I want static information in the overlay plane (2 bits) and I
> want to use OpenGL. Does anyone have a suitable code fragment?
>
> Thanks!
>
>
> Dave Heskamp
>
> phone: (216) 796 - 5383
> fax: (216) 796 - 7009
> dheskamp++at++ldsa.com
>
>
>-- End of excerpt from dheskamp++at++ldsa.com

Tyada!

This is modified from "nextfly" which comes or came with performer 2.0, the
part which writes a text string to the overlay planes has been replaced with
a circular window + crosshairs, it's even in Open GL. Call this from your
draw process.

Rgds,
Angus.

static void
OverlayHUD(pfPipeWindow *pw)
{
    double f;
    static int mapped = 0;
    pfWindow *pwOver = pfGetPWinOverlayWin(pw);
    float new_x = 0.0f, new_y = 0.0f;

      if (pwOver)
      {
        pfSelectWin(pwOver);
        if (!mapped)
        {
            static pfVec3 clrs[] = {
                {0.0f, 0.0f, 0.0f}, /* black */
                {0.8f, 0.8f, 0.6f}, /* yellow/white */
            };
            Display *dsp = pfGetCurWSConnection();
            Window xowin = pfGetWinWSDrawable(pwOver);

            pfuGLXMapcolors((pfuXDisplay*) dsp, xowin, clrs, 1, 2);
            mapped = 1;
        }
      }
      else
        return;
      glPushMatrix();
      glLoadIdentity();
      glDisable(GL_CULL_FACE);
      glDisable(GL_DEPTH_TEST);
      glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);

        /* Clear overlay planes to black in entire window */
        glClearIndex(1);
        glClear(GL_COLOR_BUFFER_BIT);
        glIndexi(0);

        glBegin(GL_TRIANGLE_FAN);
        for(f = 0.0; f< 359.5; f+=1.0)
        {
          pfSinCos((float)f, &new_x, &new_y);
          glVertex2f(new_x, new_y);
        }
        glEnd();

        glIndexi(2);
        glBegin(GL_TRIANGLE_FAN);
        for(f = 0.0; f< 359.5; f+=10.0)
        {
          pfSinCos((float)f, &new_x, &new_y);
          glVertex2f(-.8 + new_x*.07f, .8 + new_y*.07f);
        }
        glEnd();

        glIndexi(1);
        glBegin(GL_LINES);
          glVertex2f(0.0f, 1.0f);
          glVertex2f(0.0f, 0.045f);
          glVertex2f(0.0f, -1.0f);
          glVertex2f(0.0f, -0.045f);
          glVertex2f(1.0f, 0.0f);
          glVertex2f(0.045f, 0.0f);
          glVertex2f(-1.0f, 0.0f);
          glVertex2f(-0.045f, 0.0f);
        glEnd();

        glPointSize(2.0f);
        glBegin(GL_POINTS);
          glVertex2f(0.0f, 0.0f);
        glEnd();
        glPointSize(1.0f);

      glEnable(GL_CULL_FACE);
      glEnable(GL_DEPTH_TEST);
      glPopMatrix();

      pfSelectPWin(pw);
}

-- 
Angus Dorbie,
Silicon Graphics Ltd, UK
dorbie++at++reading.sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:00 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.