From: Marcin Romaszewicz (marcin++at++asmodean.engr.sgi.com)
Date: 02/29/2000 11:30:54
I'm not Angus, but I hope you'll accept my answer :).
Multipass in performer means that you render something multiple times to
achieve some effect. You can use pfDraw or pfDrawBin to draw something
from the draw callback. If you want to draw something multiple times, you
use those functions multiple times.
State management in a draw callback can get a little tricky, since
performer tracks some state but not all of it, and if you do something to
make performer lose track of rendering state, you'll see funny results.
In a multipass algorightm in performer, your best friends will be:
- pfDraw()
- pfDrawBin(...)
- pfOverride(...)
- pfPushState(), pfPopState()
- pfPushMatrix(), pfPopMatrix()
- pfGeoSet::setPassFilter(...)
- any OpenGL command you feel like using
Performer keeps track of any state you can stick into a pfGeoState, so
rendering something more than once will draw it the same each time, unless
you override per-object state by using a pfOverride.
Say you have a scene with a whole bunch of objects, and you want to
render it twice, the first time normally, and the second time using a
red material. What you would do is:
//draw normally
pfDraw();
pfMaterial *redMtl = new pfMaterial()
<do stuff to material to make it red>
redMtl->apply(); //Apply this material as the active one
//Now, don't let performer apply materials stored in scenegraph gstates
pfOverride(PFSTATE_FRONTMTL, PF_ON);
pfDraw(); //everything will draw using red material
To be sure you're not corrupting the OpenGL state or Matrix, make sure you
push state and matrix before you make any changes and pop state and matrix
before you exit the callback.
-- Marcin
On 29 Feb 2000 liaodezhi++at++990.net wrote:
> Dear Angus Dordie:
> Does multipass mean to call pfdraw() multiple times in the draw callback?
> And if so, there should be changes about graphics state. How to change?
>
>
> __________________________________________________
> 欢迎使用金陵热线免费电子邮件系统http://www.990.net
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 11:30:57 PST