Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sync with the refresh cycle...

0 views
Skip to first unread message

pro-grammer

unread,
Dec 10, 2009, 9:33:24 AM12/10/09
to
I am creating some opengl animations for an MFC project.

While the animation is in progress, I add a delay right after
rendering, hoping to get my framerate down to the monitor's refresh
rate.

However, I was wondering. Is it possible to approximately sync my
render with the beginning of the monitor refresh cycle? This way I can
make sure that I'm not rendering across 2 refresh cycles.

fungus

unread,
Dec 10, 2009, 1:45:30 PM12/10/09
to
On Dec 10, 3:33 pm, pro-grammer <akhil.malho...@gmail.com> wrote:
> I am creating some opengl animations for an MFC project.
>
> While the animation is in progress, I add a delay right after
> rendering, hoping to get my framerate down to the monitor's refresh
> rate.
>


Use the wglSwapIntervalEXT() extension for this.


--
<\___/>
/ O O \
\_____/ FTB.

http://www.topaz3d.com/ - New 3D editor for real time simulation

pro-grammer

unread,
Dec 10, 2009, 5:16:28 PM12/10/09
to
Ok from what I understand, this function is going to enable/disable
vertical sync.

So if I enable vsync, does it meant that it,

(a) tells the graphics chip not to proceed with a buffer swap until
the refresh cycle is over (This doesnt help me, as I could be
rendering away eating up my cpu. Its just the frames I have rendered
are not gonna show up on the monitor)

or

(b) causes some function of mine, either glFinish or SwapBuffers(dc)
or something to pause my execution until the current refresh cycle is
completed. (This I want! If this is it, which function has the
"pause")

Thanks!

jbwest

unread,
Dec 10, 2009, 9:13:19 PM12/10/09
to

"pro-grammer" <akhil.m...@gmail.com> wrote in message
news:900b3879-d8bd-4ad5...@m25g2000yqc.googlegroups.com...

The swapbuffers will stall until the sync is hit, your app won't keep
needlessly going.

jbw


fungus

unread,
Dec 11, 2009, 10:39:31 AM12/11/09
to
On Dec 10, 11:16 pm, pro-grammer <akhil.malho...@gmail.com> wrote:
>
>
> (b) causes some function of mine, either glFinish or SwapBuffers(dc)
> or something to pause my execution until the current refresh cycle is
> completed. (This I want! If this is it, which function has the
> "pause")
>

(b)

SwapBuffers() will wait for the refresh.

0 new messages