What is hardware cursor and how does it work?

前端 未结 3 981
醉话见心
醉话见心 2020-12-08 07:47

Is there anyone who can explain how hardware cursor works precisely? How does it relate to the graphics I\'m drawing on the screen? I\'m using OpenGL to draw, how does hardw

相关标签:
3条回答
  • 2020-12-08 07:59

    The hardware cursor is not rendered or supported by OpenGL. Some small piece of hardware overlays it on whatever image is going out the display connector - it's inserted directly into the bitstream at scan-out of each frame. Because of that, it can be moved around by changing a pair of hardware registers containing its coordinates. In the old days, these were called sprites and various numbers of them were supported on different systems.

    0 讨论(0)
  • 2020-12-08 08:06

    Hardware Cursor means, that the GPU provides to draw a (small) overlay picture over the screen framebuffer, which position can be changed by two registers (or so) on the GPU. So moving around the pointer doesn't require to redraw the portions of the framebuffer that were previously obstructed.

    Relation to OpenGL: None!

    0 讨论(0)
  • 2020-12-08 08:14

    Hardware cursors have less latency, and thus provide a better experience, because they are not tied to your game or engine frame rate but to the screen refresh rate.

    Software cursors, rendered by you as a screen-space sprite during your render loop, however, must run at the rate of your game engine. Thus, if your game experiences lag or otherwise drops below target fps, the cursor latency will get worse. A minor drop in game fps is usually acceptable, but a minor drop in cursor latency is very noticeable as a "sluggish cursor".

    You can test this easily by rendering a software cursor while leaving the hardware cursor on. (FYI, in Windows API the hw cursor function is ShowCursor). You'll find that the software cursor trails behind the hardware cursor.

    0 讨论(0)
提交回复
热议问题