Re: Overlays again

New Message Reply Date view Thread view Subject view Author view

Gordon Tomlinson (gordon++at++paradigmsim.com)
Sat, 17 Jul 1999 16:02:47 -0500


Hi Angus

I have been doing similar things with the overlay planes
and have come across a quirk, say I wish to draw a box or
cross at the centre of the channel.

When first run every thing is fine and drawn at the center
but if I resize the window or channel then "Y" seems to get
screwed., X seems fine, ( yes I am checking the window/channel
 for size changes :-) ).

Enlarging the the window see thes Box/cross move up to wards the
top of the screen and decreasing the size gets the makes it move
towards the bottom :-(

Is there a way to stop the and draw it still centred even after a resize

TIA

Gordon.

Angus Dorbie wrote:

> 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/
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

--

Regards

Gordon.

Gordon Tomlinson | Multigen - Paradigm Inc Vega Software Engineer | Suite 400, 14900 Landmark Blvd Email: gordon++at++paradigmsim.com | Dallas, Texas 75240, USA Tel: 972 960 2301 | Fax: 972 960 2303 ______________________________________________________________

'Smoke me a kipper skipper, I'll be back for breakfast' ______________________________________________________________

640K of ram should enough for anybody. Bill Gates 1981

There is no reason anyone would want a computer in their home (Ken Olson, president of Digital Equip Corp 1977 ) ______________________________________________________________

Hi Angus

I have been doing similar things with the overlay planes
and have come across a quirk, say I wish to draw a box or
cross at the centre of the channel.

When first run every thing is fine and drawn at the center
but if I resize the window or channel then "Y" seems to get
screwed., X seems fine, ( yes I am checking  the window/channel
 for size changes :-) ).

Enlarging the the window see thes Box/cross move up to wards the
top of the screen and decreasing the size gets the makes it move
towards the bottom :-(

Is there a way to stop the and draw it still centred even after a resize

TIA

Gordon.
 

Angus Dorbie wrote:

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/
-----------------------------------------------------------------------
List Archives, FAQ, FTP:  http://www.sgi.com/software/performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

-- 


Regards

Gordon.


Gordon Tomlinson              | Multigen - Paradigm  Inc
Vega Software Engineer        | Suite 400, 14900 Landmark Blvd
Email: gordon++at++paradigmsim.com | Dallas, Texas 75240, USA
Tel:    972 960 2301          | Fax:    972 960 2303  
______________________________________________________________

'Smoke me a kipper skipper, I'll be back for breakfast'         
______________________________________________________________

640K of ram should enough for anybody. Bill Gates 1981

There is no reason anyone would want a computer in their home
           (Ken Olson, president of Digital Equip Corp 1977 )
______________________________________________________________
 

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Sat Jul 17 1999 - 13:59:25 PDT

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