Forum Discussion
belltown
10 years agoRoku Guru
If you use the double-buffered approach (for reasons described in RokuMarkn's answer to your same question last week, http://forums.roku.com/viewtopic.php?f=34&t=90259), then yes, you have to take into account that you are only writing to the current back-buffer, and every time you call SwapBuffers that back-buffer becomes the next front-buffer (displayed on screen), and the new current back-buffer will contain whatever it contained before the previous call to SwapBuffers.
Rather than trying to keep track of what was written to the previous back-buffer and only displaying what has changed, you may find it easier each time through your processing loop to completely Clear the back-buffer, re-write everything, then call SwapBuffers again. For text, make sure you draw the text to a bitmap once during your initial setup then draw that bitmap to the back-buffer in each loop. The same appies to scaled images: do the scaling once to a bitmap, then write the scaled bitmap each time through the loop.
Rather than trying to keep track of what was written to the previous back-buffer and only displaying what has changed, you may find it easier each time through your processing loop to completely Clear the back-buffer, re-write everything, then call SwapBuffers again. For text, make sure you draw the text to a bitmap once during your initial setup then draw that bitmap to the back-buffer in each loop. The same appies to scaled images: do the scaling once to a bitmap, then write the scaled bitmap each time through the loop.