Re: 2D Graphics in Performer

New Message Reply Date view Thread view Subject view Author view

Allan Schaffer (allan++at++sgi.com)
Tue, 5 Oct 1999 10:19:51 -0700 (PDT)


Drat, I just hit 'send' to reply to your posting in
comp.sys.sgi.graphics. I'll copy it here:

atb2p++at++virginia.edu (Anthony Bavuso) said..
>I am building a flight simulator and need the ablility to draw flight
>instruments in the cockpit that update dynamically using Performer.
>So far all my drawing is done from the scene graph so I would like a
>pfNode derived object that does 2D drawing that I can add into my
>scene graph.
[...]
>Can someone confirm that I am not barking up the wrong tree? Thanks.

Everything that's literally in the scene graph is '3D' in that it's
transformed, rotated, clipped, culled, rendered, etc. in relation to
the viewing frustum, whereas you want the cockpit/HUD to keep the
same position on the screen as everything else moves around, so
adding the objects to the scene graph probably isn't the way to go.

A more typical way to do 2D drawing in Performer is to do a bit of
setup in the channel's DRAW callback and then issue the rendering
commands, either in plain OpenGL or using Performer's immediate-mode
rendering calls like pfApplyMtl/Tex/etc & pfDrawGSet().

There's a simple example of this shipped with Performer, check out
/usr/share/Performer/src/pguide/libpf/C/text.c, the text is rendered
in the two variations you might have in mind. Replace the code that
draws the text [drawXFontString("text over scene")] with your more
complex cockpit-rendering code and voila'.

Several of our partners who make vis-sim oriented modelling packages
have easy-to-use solutions & add-ons for this as well. Check out
http://www.sgi.com/VisSim/Solutions/ for a good starting point (click
the '2D and 3D Instruments' link).

Allan

-- 
Allan Schaffer                                            allan++at++sgi.com
Silicon Graphics                           http://reality.sgi.com/allan

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Oct 05 1999 - 10:20:08 PDT

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