Re: Scrolling text that doesn't flicker

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Dave Sexton" <dave@jwa[remove.this]online.com> wrote in message
news:%23DcSGGuBHHA.2316@xxxxxxxxxxxxxxxxxxxxxxx
But for scrolling text you can't draw everything only once. It's
scrolling!

Yes, you can (assuming you can draw the background with the text as you
described). There will be x frames per second, for each frame if you draw
each pixel on the surface only once then you don't need double buffering.

I really don't understand what you mean. How would that prevent Windows
from clearing the render target before the next operation?

He's saying that, if you had a way to ensure that each pixel on the screen
that has changed is drawn only once, setting it to the exact desired new
value, you can, once per frame, draw everything only once.

Obviously something animated has to be drawn multiple times. But the
flicker doesn't result from that. It results from drawing things multiple
times *per frame*. That's what he means to avoid.

In theory, it's even possible to do so (see my other post, about using
regions to mask the text area while filling the remaining background). In
reality, that's a) a much more complicated solution than using an off-screen
buffer, and b) may not even perform as well (since it would rely on using
regions to mask the text area while the background is being drawn).

I always thought double-buffering worked like the swap chain in DirectX,
where the back buffer is simply presented instead of the target being
cleared. Without the buffer, I assumed Windows will clear the target
automatically for each WM_PAINT message, causing a flicker.

Care to explain in more detail?

This is why I dislike the use of the term "double buffering" to describe
this. It's similar to, but not exactly the same as, the existing
double-buffering (or even triple-buffering, as is sometimes the case) used
in DirectDraw. In DirectDraw, double-buffering means there are two entire
frame buffers. One is always being used by the video card's RAMDAC to
display an image on the monitor, and the other is the one being drawn to at
that given moment. Once drawing has been completed, the entire active frame
buffer is switched (flipped), and the process starts anew.

This is kind of what the .NET "double buffering" is doing, except that it's
not a low-level hardware thing. There's an alternate, off-screen buffer and
rather than flipping the actively displayed buffer, the off-screen buffer is
simply copied to the active on-screen buffer. I don't like using the same
term for both, because it confuses the issue.

By doing this, any pixel that changes on the screen is drawn exactly once
for a given change (frame). Which is what needs to happen to avoid flicker.
And it certainly can happen that way, even as the text is scrolling. The
requirement is that the drawing happens once for each change, not that it
only happen once period.

Pete


.



Relevant Pages

  • Re: VB and graphics
    ... however anything that's drawn outside the area of the control is clipped and not drawn. ... which you can draw to then you'll need what's known as a back buffer, be that entirely constructed in memory or a picture box ... You can then draw a section of the back buffer to your viewport which could be based on the players ... The reason for drawing everything to the back-buffer rather than directly to the screen is that the monitor can generally display ...
    (microsoft.public.vb.general.discussion)
  • RFC/Doc/BUGs: CONFIG_PACKET_MMAP
    ... configurable circular buffer mapped in user space. ... circular buffer of unswapable memory mapped in the capture process. ... the name indicates, this function allocates pages of memory, it allocates a power ... There is another vector of pointers, wich hold references to each frame ...
    (Linux-Kernel)
  • Re: Streaming video over serial?
    ... In my specific scenario, where I'm not actually streaming video but an interactive application, quality actually trumps frame rate at about the 1Hz rate. ... I agree that for actual *usability* from an Apple client, dropping to lores would be great, but it's not necessary in this case. ... the Apple side it goes straight to frame buffer. ... to switch buffers and screens. ...
    (comp.sys.apple2.programmer)
  • Re: C3088 CMOS Imaging Sensor Questions
    ... Which require LOTS of computation time and memory to process. ... To maintain an reasonable speed on frame update or just for processing. ... having an input buffer and an output (or temporary ... Some people use algorithms that ASSUME that if they take several pictures ...
    (comp.arch.embedded)
  • Re: Scrolling text that doesnt flicker
    ... you can (assuming you can draw the background with the text as you ... There will be x frames per second, for each frame if you draw ... Obviously something animated has to be drawn multiple times. ... buffer, and b) may not even perform as well (since it would rely on using ...
    (microsoft.public.dotnet.languages.csharp)