OpenGL AntiAliasing and Background Quad

I draw the background behind my 3D scene, which works as expected (code below). I also smooth the scene using the accumulation buffer (chapter 10 of the red book).

... loop several times (say n) through code that shivers and draws an image (jitter moves the image to a slightly different position), accumulating data with

glAccum(GL_ACCUM, 1.0/n)

and finally the challenge

glAccum(GL_RETURN, 1.0)

However, I do not want to smooth the background. The problem is that calling glAccum with GL_RETURN copies (overwrites) the values ​​in the color buffer (instead of using the depth and blend functions, etc.) to mask the values ​​written to the color buffer.

How to draw a background before or after smoothing a 3D scene so that the background looks the same as when drawing a 3D scene without smoothing?


 // 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
+3
1

, . , , . , .

+2

Source: https://habr.com/ru/post/1723508/


All Articles