Re: Overlay graphics on performer

New Message Reply Date view Thread view Subject view Author view

Steve Fuhrman (steve++at++crusher.paradigmsim.com)
Wed, 16 Aug 1995 15:55:18 -0500


On Aug 16, 1:15pm, SSPSU91++at++aol.com wrote:
> Subject: Overlay graphics on performer
> The following question is related to page 365 of the IRIS Performer
> Programming Guide, the frequently asked question "How do I overlay graphics
> on top of my IRIS Performer scene?" .
> For steps 3 (save and clear the projection matrix) and 5 (save and clear the
> modelling matrix) of the answer what are the specific Performer calls to do
> this? Also for steps 7 and 9 (restoring the modelling and projection
> matrices).
> Is there an example of this anywhere in the Performer library?
>
> Stephanie Sroczyk, JJM Systems Inc.
>
>-- End of excerpt from SSPSU91++at++aol.com

Hi,

  Here is an example of a pre-draw callback that draws a 2D starfield in a
  channel.

  getmatrix is a BAD call to make from a performance point of view, if you
  have the matrices cached use those values instead. I was lazy and used
  getmatrix as this was not used in a "real-time" (30 or 60 frames per second)
  application.

  These are GL calls as opposed to Performer calls. One of the nicest features
  of Performer is that you are not prevented from using GL or OpenGL calls as
  needed to accomplish your tasks.

static void _DrawStars(pfChannel *channel, APP *p)
{
    int i;
    Boolean zstate;
    long mode;
    static int first = TRUE;
    static pfMatrix identity, pmatrix, vmatrix;

    if (p->starMode == VG_OFF) return;

    if (first) {
        pfMakeIdentMat(identity);
        first = FALSE;
    }

 pfPushState();

    zstate = getzbuffer();

    zbuffer(FALSE);

    pfBasicState();

    pfDisable(PFEN_TEXTURE);

    mode = getmmode();

    mmode(MPROJECTION);

    getmatrix(pmatrix);

    ortho2(-0.5f, 719.5f, -0.5f, 485.5f);

    mmode(MVIEWING);

    getmatrix(vmatrix);

    loadmatrix(identity);

    cpack(0xffffffff);

    bgnpoint();
        for (i=0;i<p->numStars;i++) v2s(p->star[i]);
    endpoint();

    loadmatrix(vmatrix);

    mmode(MPROJECTION);

    loadmatrix(pmatrix);

    mmode(mode);

    zbuffer(zstate);

    pfPopState();
}

Good Luck with your application,

-- 

Steve Fuhrman ___________________________________________________________

steve++at++paradigmsim.com Paradigm Simulation Inc. voice: 214-960-2301 14900 Landmark Blvd. Suite 400 fax: 214-960-2303 Dallas, Texas 75240 ___________________________________________________________

Hamilton's Rule for Cleaning Glassware The spot you are scrubbing is always on the other side. Corollary: If the spot is on the inside, you won't be able to reach it.


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:51:48 PDT

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