View Full Version : How to avoid screen update "tearing"?
How can I avoid "Tearing" on screen updates? If i do a aglswapdoublebuffer in the middle of a video update, part of the old image is drawn, and part of the new one is. The problem is that I can't tell when a video update is going to occur.
Is there someway of manually counting the number of video refreshes since startup? That way I could poll that number, and only redraw when it increases.
Use aglSetInteger to set the Swap Interval to something like 1. That makes OpenGL wait for a screen refresh before drawing.
b = aglGetInteger(data->context, AGL_SWAP_INTERVAL, &val);
b = aglSetInteger(data->context,AGL_SWAP_INTERVAL, &val);
Or set the "swapinterval" property of the OpenGL control in my Realbasic plugin: http://www.playground.ltc.vanderbilt.edu/~holtondl/oglplug.sit.hqx
12-12-2000, 11:20 AM
At this time aglSwapInterval is not yet implemented so callling this function makes no diference.
The only way to avoid tearing is to install
a VBL task (see Apple developer web site to find more info.) to test when the screen refresh is at the vertical retrace, and only then call aglSwapBuffers.
Also you should make shure to call glFlush() before swaping the buffers .
Unfortunately syncing to the VBL by installing a VBL task, then calling aglFlush(), then calling aglSwapBuffers() *still* results in tearing. :-(
For futher discussion and a demo, please contact me directly at <email@example.com>.
AGL_SWAP_INTERVAL is documented in Apple's AGL reference included with the OpenGL download.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.