Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would guess that io2d::refresh_style::as_fast_as_possible means as opposed to Vsync. Vsync times drawing or at least buffer swapping so that you don't get video artifacts due to the monitor reading say half of one frame and half of another. Vsync is not as fast as possible assuming you can render faster than 60 fps on a typical monitor.

Also, who says the game will control the loop? In Javascript (requestAnimationFrame) and many other frameworks, that's not true.



> I would guess that io2d::refresh_style::as_fast_as_possible means as opposed to Vsync. Vsync times drawing or at least buffer swapping so that you don't get video artifacts due to the monitor reading say half of one frame and half of another. Vsync is not as fast as possible assuming you can render faster than 60 fps on a typical monitor.

That'd be a reasonable theory except it's not how any of this works anymore. Unless you are exclusive fullscreen it's not possible to get tearing on any modern compositor. Window's DWM, Android's SurfaceFlinger, Linux's Wayland, etc... on all of those you're drawing to an offscreen surface, and when you flip it doesn't go directly to the display it goes to the compositor. You're basically always vsync'd by the compositor. So for a windowed application what you really want is more like Android's Choreographer, or JavaScript's requestAnimationFrame - a callback that just says "hey if you want you could redraw now" for rate limiting purposes more than anything else.

And even if you are exclusive fullscreen there's things like adaptive vsync or even just choosing an alternate refresh rate.

> Also, who says the game will control the loop? In Javascript (requestAnimationFrame) and many other frameworks, that's not true.

requestAnimationFrame is simply a callback and entirely optional. That'd be backpressure control more than anything else, and you'd still have things like input intermixed with it.

Also C++ has threads, so discussing games or loops in JavaScript vs. C++ doesn't really apply in the same ways.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: