Re: State changes for post-draw GL callbacks
John Rohlf (jrohlf++at++tubes)
Mon, 9 Jan 95 11:38:29 PST
>
>
> Hello,
>
> My applications often require 2-D symbology to be overlayed
> on top of a simulation channel. The 2-D symbology could be
> a VAPS or a DWB object, but when its trivial in nature I
> like to use home-brewed GL code. A typical GL overlay call
> would assume an orthogonal view in a unit channel between
> -1 and 1. Since Performer is a 3-D application, I must
> performer the transformations myself. An example of this
> follows: (please excude psuedocode as I have neither manual
> not code with me :)
>
> postdraw ()
> {
> pfPushState();
> pfBasicState();
> something to overwrite pizels in z-buffer
> ortho2(-1.0, 1.0, -1.0, 1.0);
>
> pushmatrix();
> create a 4x4 identity matrix
> loadmatrix();
>
> update_overlay ( overlay_data );
>
> popmatrix();
> reset z-buffer
> pfPopState();
> }
>
>
> This code works just fine, but I wonder if the state and
> matrix changes are seriously affecting frame-rate in the
> most time-critical section of the rendering loop. It
> should be noted that this procedure if sometimes repeated
> (up to four times) for each channel, with up to six
> channels, 20 times a second.
The above is the recommended method for doing overlays in
Performer. I don't think that 20 times a second is a big deal
but you can always stub out the overlay code and compare rendering
times. CAVEAT: Changing between NORMALDRAW and OVERDRAW drawmodes is death
so unless you have completely static overlay graphics we recommend that you
draw into the main frame buffer with ortho2() and zfunction(ZF_ALWAYS).
This archive was generated by hypermail 2.0b2
on Mon Aug 10 1998 - 17:50:51 PDT