Re: Overlays again

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie (dorbie++at++sgi.com)
Fri, 16 Jul 1999 14:17:14 -0700


Andy Bailey wrote:
>
> Hi,
>
> I posted something yesterday, but got no replies, but open reading the
> last message again, I know it was a little garbled and I did not really
> know what I was talking about! Basically I am having problems drawing on
> overlay over the scene. All I need to do is draw a small red square in
> the centre of the window, and I need it as an overlay, i.e. the scene is
> still being updated behind it. It does not need to be transparent or
> anything like that, just a simple red square. That is my first problem.
> How do I draw a red square? The second problem is getting the overlay to
> work. I think I am setting it up correctly with the following code...
>
> ViewState->pw = new pfPipeWindow(pfGetPipe(0));
> ViewState->pw->setName("Main window");
> ViewState->pw->setWinType(PFPWIN_TYPE_X);
> ViewState->pw->setMode(PFWIN_HAS_OVERLAY, PF_ON);
> ViewState->pw->setOriginSize(350, 350, 350, 350);
> ViewState->pw->open();
>
> I just want to use the default overlay setup.

You can see most of this done in perfly I lifted some of this from
there.
You need an overlay visual but once you have this do something like the
following in your draw callback. Note that it is only required once,
unless you get a resize,refresh or similar. Note some of this stuff like
the color map & check for overlay you wouldn't have to do every time.

/* get pipe window from channel */
pfPipeWindow *pw = pfGetChanPWin(chan);
/* confirm you have overlay in the pipe initialization functionthis with
*/
if (pfGetPWinOverlayWin(pw) ? 1 : 0);

/* get's the overlay window */
pfWindow *pwOver = pfGetPWinOverlayWin(pw);

/* Push state & Set up viewport ets if required */
/* clear to transparent */
pfClear(PFCL_COLOR, NULL);

/* make color map */
static pfVec3 clrs[1] = { {1.0f, 0.0f, 0.0f} }; /* red color */
pfuMapWinColors(pwOver, clrs, 1, 1); /* one color starting at 1 */

/* draw the red square here using OpenGL color index & other calls */
glIndexi(1);
glBegin();
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);
glEnd();

/* pop state if required */
/* all done so go back to the pipe window */
pfSelectPWin(pw);

Cheers,Angus.

-- 
Never express yourself more clearly than you think.
                                       Neils Bohr 

For advanced 3D graphics Performer + OpenGL based examples and tutors: http://www.dorbie.com/


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Jul 16 1999 - 14:17:28 PDT

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