Steve Fuhrman (steve++at++crusher.paradigmsim.com)
Wed, 16 Aug 1995 15:55:18 -0500
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.
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:48 PDT