Re: background texture using glDrawPixels

New Message Reply Date view Thread view Subject view Author view

From: Angus Dorbie (dorbie++at++sgi.com)
Date: 10/13/2000 03:07:25


Oops, got it slightly wrong on the followup, it's flickering because the
position is getting clipped (not a fragment test) randomly on each frame
after transformation through modelview, proximity to the corner is also
a risk. Same solution except you might want to bring the corner in in
eye space x, y by a small ammount.

also in the last email I meant to suggest multiplying the WHOLE vector
not just the Z term.
Because of the vertex edge clip I'd do this:

farPlaneLL[0] * .99998 <- note slightly smaller
farPlaneLL[1] * .99998 <- note slightly smaller
farPlaneLL[2] * .99999

Cheers,Angus.

Angus Dorbie wrote:
>
> It has been pointed out to me by a benevolent list lurker that this is
> not the only explanation and may not be the right answer.
>
> The alternative and perhaps more likely explanation is that the draw
> pixels if flickering because it is drawn EXACTLY at the far clip plane
> is being z fragment clipped at the far plane due to rounding errors. The
> solution is to position the image nearer the eye by multiplying
> farPlaneLL[2] by 0.99999 or so.
>
> Cheers,ANgus.
>
> Angus Dorbie wrote:
> >
> > No clear in pfDraw, you are expected to clear if you have a draw
> > callback on a channel.
> >
> > You may not need to clear if you set your depth test to always when you
> > draw the image.
> > Same thing goes for stencil test and write when drawing.
> >
> > In general your code should work I as far as I can tell. Are you sure
> > you are double buffered?
> >
> > Cheers,Angus.
> >
> > Yoram Shahak wrote:
> > >
> > > Hi,
> > >
> > > I am trying to implement background texturing using glDrawPixels in my
> > > draw call back.
> > > my code looks something like this :
> > >
> > > void drawCallBack(pfChannel *chan, void *data)
> > > {
> > > preDraw(chan, data);
> > > pfDraw();
> > > }
> > >
> > > void preDraw()
> > > {
> > > chan->clear();
> > > glClearStencil(0x0);
> > > glClear(GL_STENCIL_BUFFER_BIT);
> > >
> > > pfVec3 farPlaneLL, dummy;
> > > chan->getFar(farPlaneLL, dummy, dummy, dummy);
> > >
> > > glRasterPos3f(farPlaneLL[0], farPlaeLL[1], farPlaneLL[2]);
> > > glDrawPixels(winWidth, winHeight, imageFormat,GL_UNSIGNED_INT,
> > > imageBuffer);
> > >
> > > }
> > >
> > > As a result I get the background image flickering if at all seen.
> > > Does performer clear the gl buffer in pfDraw ?
> > > Am I going totally the wrong way about implementing this ?
> > >
> > > Please help .
> > > Thanx.
> > >
> > > :o)
> > >
> > > Yoram Shahak
> > > DreamTeam ltd.
> > >
> > > -----------------------------------------------------------------------
> > > List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> > > Submissions: info-performer++at++sgi.com
> > > Admin. requests: info-performer-request++at++sgi.com
> >
> > --
> > For Performer+OpenGL tutorials http://www.dorbie.com/
> >
> > "In the middle of difficulty lies opportunity."
> > --Albert Einstein
> > -----------------------------------------------------------------------
> > List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> > Submissions: info-performer++at++sgi.com
> > Admin. requests: info-performer-request++at++sgi.com
>
> --
> For Performer+OpenGL tutorials http://www.dorbie.com/
>
> "In the middle of difficulty lies opportunity."
> --Albert Einstein
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
For Performer+OpenGL tutorials http://www.dorbie.com/

"In the middle of difficulty lies opportunity." --Albert Einstein


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Oct 13 2000 - 03:07:36 PDT

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