SwapBuffers

The SwapBuffers function exchanges the front and back buffers if the current pixel format for the window referenced by the specified device context includes a back buffer.

BOOL SwapBuffers(
  HDC  hdc  // device context whose buffers get swapped
);

Parameters

hdc
Specifies a device context. If the current pixel format for the window referenced by this device context includes a back buffer, the function exchanges the front and back buffers.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To get extended error information, call GetLastError.

Remarks

If the current pixel format for the window referenced by the device context does not include a back buffer, this call has no effect and the content of the back buffer is undefined when the function returns.

With multithread applications, flush the drawing commands in any other threads drawing to the same window before calling SwapBuffers.

Requirements

  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in wingdi.h.
  Import Library: Use opengl32.lib.

See Also

OpenGL on Windows NT, Windows 2000, and Windows 95/98, Win32 Functions


  

Community Additions

Show: