Re: copy z-buffer with scaling on iR

New Message Reply Date view Thread view Subject view Author view

Rob Jenkins (robj++at++quid)
Tue, 21 Oct 1997 16:54:06 -0700


On Oct 21, 11:27am, Hansong Zhang wrote:
> Subject: Re: copy z-buffer with scaling on iR
> > > > Do you have latest iR gfx patches ? ( 1808 for Onyx, 2191 for Onyx2 )
> > >
> > > I don't know. Have to ask the facilities.
> > >
> >
> > You can see with: versions | grep patch
> >
>
> I don't think we have the patches you mentioned:
> versions | grep patch | grep 1808 shows nothing (the machine is Onyx
> chasis with iR upgrade). Our largest-numbered patch is actually 1460.
>

You must have one of the Onyx iR gfx patches ( 1460 is an iR gfx diagnostics
patch ). Run 'versions | grep -i patch' and look through the descriptions of
the patches for something like 'InfiniteReality N Release' where N will 2nd,
third, or fourth for patches 1355, 1699 or 1808 respectively.

If you have any of those patches prior to 1808 the I would recommend getting
1808 ( log a support call with you local office ). I can't be sure it will fix
your problem but it has many other fixes and performance enhancements in.

>
> > > > Does it work with no zoom ? ( or other values of zoom )
> > >
> > > Yes. 512x512 -> 512x512 copy is no problem.
> > >
> >
> > So DEPTH_TEST enabled/disabled as you describe below has no effect ( ie
always
> > works ) if pixelzoom == 1.0 ?
> >
>
> That's right. When doing no-zoom copies DEPTH_TEST on/off has no effect.
> The copy is fine either way.
>

This is important and doesn't sound right, the zoom shouldn't change behaviour.

> > > DEPTH_TEST is off. Turns out this is the problem. So on iR if there's no
> > > DEPTH_TEST, there's no depth write. Generally I think this is not quite
> > > right - no DEPTH_TEST should mean writes without any condition
> > > Anyway, the convention should at least be the same across machines.
> >
> > Well, man glEnable says:
> > ...
> > It doesn't say that if disabled then update depth buffer. Just so I'm
clear, do
> > you have DEPTH_TEST on while you draw, then turn it off to copypixels or is
it
> > always the same state ?
> >
>
> DEPTH_TEST is on when I draw geometry. Then I disable it to do tricks:-)
> The zbuffer copy code happened to be after the depth test's disabled, and
> before it's re-enabled for the next draw.
>

This makes sense, you typically should turn off any fragment type operations
you can before doing GL pixel operations to shorten the pixel path and get
better performance.

> > Do you know if you actually had a multisampled visual, use glXGetConfig in
code
> > on your visual, or use the xwininfo command:
> > use -tree option to get all windows then use the -id option on the window
> > that's your main draw window, this will show which visual you use. You can
look
> > at the visual data then with findvis.
> >
>
> The visual is 0x5a:
>
> 0x5a, RGBA 12/12/12/12, db, Z 23, S 1
>
> I guess S1 means no multisampling. And I see obviously zig-zag on polygon
> edges.
>

Actually S1 means the visual has 1 stencil plane, the number of samples in a
visual is shown like this ( see man findvis ):

0x77, RGBA 10/10/10/0, db, Z 16, samples 4

> Actually this is another problem: about a year ago when I was using
> GLUT-3.1, multisampling is fine, but after upgrading to 3.2... etc, I lost
> it - for the same code. But I'll ask Mark Kilgard about this.
>

It's unlikely that Mark broke something so fundemental without noticing, I
expect it's due to some other difference like ( just guessing ): You have less
RM boards or you ask for different visual characteristics and end up with no
samples or you have a different vof etc. Could you break your initial window
setup code down to a simple test case so we can consider that seperately ?

I'll look into this more and get back to you.

Cheers
Rob

> > The simplest thing might be if you could send me the code you are using,
sounds
> > like we should get the story straight, especially if behaviour is different
> > depending on pixelzoom. If your code is large then it might be a useful
> > exercise to narrow it down to a small test case, that always helps in these
> > cases.
> >
> Yes the program is big (with my own Performer-like data structure!)... but
> the parts that causes the problem are simple, so here it is:
>
> glColorMask(0,0,0,GL_TRUE);
> glClear(GL_COLOR_BUFFER_BIT);
> glColor4f(1,1,1,1);
>
> glDisable(GL_DEPTH_TEST);
> .
> .
> .
> // The following call is key to the problem. Without it
> // copy with 0.5 zoom factor won't work (i.e. when
> // cam_w=cam_h=512, copy_w=copy_h=256)
>
> // glEnable(GL_DEPTH_TEST);
>
> //glDepthFunc(GL_ALWAYS);
> glDepthMask(GL_TRUE);
> CopyPixels(cam_w, cam_h, copy_w, copy_h,
> cam_x0, cam_y0, copy_x0, copy_y0, GL_DEPTH);
> glReadPixels(copy_x0, copy_y0, copy_w, copy_h,
> GL_DEPTH_COMPONENT, GL_FLOAT, zbuffer);
> glDepthMask(0);
> glDisable(GL_DEPTH_TEST);
>
> // The following always works.
> // Copy color buffer for debugging purposes only
> glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
> CopyPixels(cam_w, cam_h, copy_w, copy_h,
> cam_x0, cam_y0, copy_x0, copy_y0, GL_COLOR);
> glColorMask(0,0,0,GL_TRUE);
>
>
> The CopyPixels() function called above is:
>
> void CopyPixels(int fromWidth, int fromHeight, int toWidth, int toHeight,
> int fromX, int fromY, int toX, int toY,
> int type)
> /* type can be GL_COLOR, GL_DEPTH, GL_STENCIL */
> {
> float oldxfactor, oldyfactor;
> float xfactor = (float) toWidth / (float) fromWidth;
> float yfactor = (float) toHeight / (float) fromHeight;
> int oldviewport[4];
>
> PushViewProjMat();
> glGetIntegerv(GL_VIEWPORT, oldviewport);
> Go2D_NoScissor(toX, toY, toWidth, toHeight);
> glRasterPos2i(0, 0);
>
> glViewport(oldviewport[0],oldviewport[1],oldviewport[2],oldviewport[3]);
> PopViewProjMat();
> glGetFloatv(GL_ZOOM_X, &oldxfactor);
> glGetFloatv(GL_ZOOM_Y, &oldyfactor);
> /* set zoom factor */
> glPixelZoom(xfactor, yfactor);
>
> glCopyPixels(fromX, fromY, fromWidth, fromHeight, type);
> GLenum error = glGetError();
> if (error != GL_NO_ERROR) {
> fprintf(stderr, "GL Error in CopyPixels: %d\n", error);
> }
>
> /* restore old zoom factors */
> glPixelZoom(oldxfactor, oldyfactor);
> }
>
>
>
> Enjoy,
> Hansong
>-- End of excerpt from Hansong Zhang

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:06 PDT

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