SwapBuffers()什么用?怎么用?(50分)

  • 主题发起人 主题发起人 WinXP
  • 开始时间 开始时间
用来交换前后缓冲区的内容,如:动画中前缓冲区放置一幅图片,后面放置一幅图片,用这个函数做交换,
就可以形成动画!前题作切换前必须前后缓冲区都有内容,否则无效!
 
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
);
Parameter

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 Value

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. Call GetLastError for extended error information.

Remarks

If the current pixel format for the window referenced by the device contextdo
es not include a back buffer, then
this call has no effect. The content of the back buffer is undefined when the function returns.
A multithreaded application should flush the drawing commands in any other threads drawing to the same window before calling the SwapBuffers function.
 
SwapBuffers(DC);
它通常是应用在OpenGL中,用以实现三维图形的场景转换;
我们一般的应用程序是不会用到的。
 
后退
顶部