views:

419

answers:

1

I'm drawing a background behind my 3D scene which works as expected (code below). I'm also anti-aliasing the scene using the accumulation buffer (chapter 10 of the red book).

...loop several times (say, n) through code that jitters and draws the image (jittering is moving the image to a slightly different position), accumulating the data with

glAccum(GL_ACCUM, 1.0/n)

and finally calling

glAccum(GL_RETURN, 1.0)

However, I do not want to anti-alias the background. The problem is that calling glAccum with GL_RETURN copies (overwrites) the values in the color buffer (rather than using the depth test and blend functions, etc) to mask the values being written to the color buffer.

How can I draw the background before or after anti-aliasing the 3D scene so that the background looks just like it does when I draw the 3D scene without anti-aliasing?


 // Draw the background.

 glMatrixMode GL.GL_PROJECTION
 glLoadIdentity

 glMatrixMode GL.GL_MODELVIEW
 glLoadIdentity

 glPolygonMode GL_FRONT_AND_BACK, GL_FILL

 glDisable glcDepthTest

   glBegin bmQuads

     // Call glColor and glVertex here.

   glEnd

 glEnable glcDepthTest
+2  A: 

If you're just after the appearance, and not looking for a rendering acceleration, don't jitter the background. Your loop would draw the background, apply the jitter, then draw the foreground. Since the background never moves, the accumulated background would be aliased.

Mr. Berna
As stated above, the problem with drawing the background before jittering is that calling glAccum with GL_RETURN copies (overwrites) the values in the color buffer (rather than using the depth test and blend functions, etc) to mask the values being written to the color buffer. The color and depth buffers must also be cleared with each jitter.Perhaps I did not understand your answer.
JRS
Each time through the loop you would draw the entire image. The area you consider background, which doesn't get anti-aliased, is identical each time. The foreground, which does get anti-aliased, varies by a small displacement each time.
Mr. Berna