COpenGL::JitterScene

void JitterScene( int JitterIndex, int TotalJitterPoints );

Parameters

JitterIndex Specifies the zero based jittering index. It can be any value from 0 to TotalJitterPoints - 1.
TotalJitterPoints Specifies the number of frames used for view projection jittering. The parameter can be any of following values : 2, 3, 4, 5, 6, 8, 9, 12, 16. The higher the TotalJitterPoints value is, the better antialiasing will be achieved.

Remarks

The JitterScene method function jitters the objectís view projection for scene antialiasing purposes for using the accumulation buffer. Use several jittered projections to add scene frames into the accumulation buffer.

Example

#define ANTIALIASING_QUALITY	5	// may be 2,3,4,5,6,8,9,12,16
void COglSampleView::OnPaint() 
{
  CPaintDC    dc(this); // device context for painting
  if ( m_Antialiasing == TRUE )
  {  // do scene antialiasing
     int     i;
     // display a hourglass cursor because antialiasing takes a while ...
     theApp.DoWaitCursor( 1 );
     // perform accumulation buffer antialiasing cycle
     for ( i = 0; i < ANTIALIASING_QUALITY; i++ )
     {
        // jitter scene projection for the next picture
        m_OpenGL.JitterScene( i, ANTIALIASING_QUALITY );
        // draw a picture into back color buffer
        DrawScene( NULL );
        if ( i == 0 )
              // load picture into the accumulation buffer
              glAccum( GL_LOAD, 1.0f / ANTIALIASING_QUALITY );
        else
              // add picture into the accumulation buffer
              glAccum( GL_ACCUM, 1.0f / ANTIALIASING_QUALITY );
        if ( i != ANTIALIASING_QUALITY - 1 )
              // clear the color and the depth buffers
              glClear
              ( 
              ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )
        & m_OpenGL.GetClearValue()
              );
        }
        // copy antialiased picture from the accumulation buffer to the color buffer
        glAccum( GL_RETURN, 1.0f );
        // restore unjittered view projection
        m_OpenGL.UnJitterScene();
        // restore the cursor
        theApp.DoWaitCursor( -1 );
   }
   else
        DrawScene();
   // finish OpenGL window drawing operations
   m_OpenGL.DrawEnd();
}

See Also

UnJitterScene