Re: Draw callback problem

New Message Reply Date view Thread view Subject view Author view

From: Allan Schaffer (allan++at++sgi.com)
Date: 02/28/2000 15:16:46


On Feb 28, 2:06pm, Andy Bailey wrote:
> Here is the code...
[...]
>
> pfDraw();
> pfPushState();
> pfBasicState();
  [draw sky poly]
> pfPopState();
>
> This is giving me the desired sky effect in front of the object and it
> is rotating with the heading of the object OK. But when I pitch or roll
> the object the polygon is also pitching/rolling which is not what I
> want. I suspect this is a problem with the view matrix having the pitch
> and roll in already, and that I need to start with the identity matrix.
> Am I right or is there something else?

Right. As you enter the channel draw callback Performer has already
set up the OpenGL projection and transformation matrices
appropriately for that channel's viewpoint.

You'll want to surround the drawing of your sky polygon(s) with a
  pfPushIdentMatrix();
  pfRotate(PF_X, -90); /* convert to Z-up */
  [draw sky]
  pfPopMatrix();

> Also does this seem like a good idea for getting around the off-axis
> viewing frusta problem with pfEarthSky?

I'd suggest putting the sky-drawing code before pfDraw. It's
typically more efficient to send that one big polygon right at the
beginning of the frame, since it'll get the FILL portion of your
graphics pipeline busy while smaller triangles from pfDraw() work
their way through the XFORM stage.

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 2b29 : Mon Feb 28 2000 - 15:16:50 PST

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