X11 How to get window data pointer?

On the Wikipedia page for multiple buffering, under page flipping it says:

In the page-flip method, instead of copying the data, both buffers are capable of being displayed (both are in VRAM). At any one time, one buffer is actively being displayed by the monitor, while the other, background buffer is being drawn. When the background buffer is complete, the roles of the two are switched. The page-flip is typically accomplished by modifying the value of a pointer to the beginning of the display data in the video memory.

The page-flip is much faster than copying the data and can guarantee that tearing will not be seen as long as the pages are switched over during the monitor's vertical blanking interval—the blank period when no video data is being drawn. The currently active and visible buffer is called the front buffer, while the background page is called the "back buffer".

So how would you do something like
int &current = XGetPixelPointer(window);
int &a = current;
int &b = current + (width * height * 3);
while (running) {
    current = a;
    current = b;
Last edited on
You need to get the current framebuffer pointer every time you're about to render.
Can I not set the frame buffer pointer to use double-buffering?
A pointer is nothing but an integer that refers to a memory location. All you can do is make it point somewhere and read where it's pointing to. That's it.
I'm asking if can you tell the X API to change its rendering pointer to a different address. To quote Wikipedia, "The page-flip is typically accomplished by modifying the value of a pointer to the beginning of the display data in the video memory." How do you accomplish this with X?
If you've configured X to use double buffering, there should be a function that performs a buffer swap and changes what pointer is returned by XGetPixelPointer(), I'd imagine. Doing a simple search for "x11 buffer swap" gives this result: http://www.pickinpatchfarm.com/releases/X11R7.7/doc/libXext/dbelib.html
XdbeSwapBuffers() looks promising.
Topic archived. No new replies allowed.
  • 1007451581 2018-02-22
  • 8908121580 2018-02-22
  • 141161579 2018-02-22
  • 9421578 2018-02-22
  • 2826901577 2018-02-22
  • 3647361576 2018-02-22
  • 5717551575 2018-02-22
  • 523811574 2018-02-22
  • 6439871573 2018-02-22
  • 8109431572 2018-02-22
  • 8757321571 2018-02-22
  • 5265111570 2018-02-22
  • 3351351569 2018-02-22
  • 5109361568 2018-02-22
  • 4455391567 2018-02-22
  • 9091121566 2018-02-22
  • 24791565 2018-02-22
  • 2486841564 2018-02-21
  • 9847231563 2018-02-21
  • 9264681562 2018-02-21