Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
bcoding
Level 7

single buffer vs double buffer roscreen

Hi,
I am not 100% clear on single buffer and double buffer. Reading the documentation and playing with some examples helped to give a rough picture however, I would really appreciate if anyone could explain the difference between them and in which condition would each one is appropriate to use?

Thanks in advance
0 Kudos
8 Replies
RokuMarkn
Level 7

Re: single buffer vs double buffer roscreen

In a single buffered screen there is just one bitmap. Periodically a snapshot of this bitmap is copied to the screen. The danger is if you happen to be in the middle of modifying the bitmap when it is copied, the screen might receive a partially modified bitmap. Double buffering solves this problem by having two bitmaps, one for the screen and one that can be freely modified without affecting the screen. Only when you explicitly call SwapBuffers (presumably when you've finished a set of modifications) does the modifiable bitmap become available to the screen.

The bottom line is there are very few cases where it's appropriate to use a single buffered screen. Unless you have a very good reason, you should always use double buffering.

--Mark
0 Kudos
bcoding
Level 7

Re: single buffer vs double buffer roscreen

"RokuMarkn" wrote:
In a single buffered screen there is just one bitmap. Periodically a snapshot of this bitmap is copied to the screen. The danger is if you happen to be in the middle of modifying the bitmap when it is copied, the screen might receive a partially modified bitmap. Double buffering solves this problem by having two bitmaps, one for the screen and one that can be freely modified without affecting the screen. Only when you explicitly call SwapBuffers (presumably when you've finished a set of modifications) does the modifiable bitmap become available to the screen.

The bottom line is there are very few cases where it's appropriate to use a single buffered screen. Unless you have a very good reason, you should always use double buffering.

--Mark


Thanks a lot for the info. So I will use double buffer then. Is it possible to have a list screen within a roscreen. I mean I want to display list of scrollable text in the screen however I want the background to be an image. Also I do not want the overhang of listscreen, I just want the part where it displays the text content and I can scroll through them.
So, I was guessing that I can define the region somewhere in the roscreen and have list screen placed over there. Is it possible? If not are there any other alternatives for displaying scrollable text with a background image and without the overhangs?

Thanks.
0 Kudos
NewManLiving
Level 7

Re: single buffer vs double buffer roscreen

No you cannot mix the two. The roScreen has a stack of its own. Everything would have to be done with the use of the 2D interface. There is a learning curve but if your up to it And have the time to learn it then it's quite rewarding. But it does take time to understand and then build your own lists, menus and grids. It's like buying a cake from the store (top level components ) or baking it yourself. The ingredients being the 2D interface objects and functions
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
bcoding
Level 7

Re: single buffer vs double buffer roscreen

"NewManLiving" wrote:
No you cannot mix the two. The roScreen has a stack of its own. Everything would have to be done with the use of the 2D interface. There is a learning curve but if your up to it And have the time to learn it then it's quite rewarding. But it does take time to understand and then build your own lists, menus and grids. It's like buying a cake from the store (top level components ) or baking it yourself. The ingredients being the 2D interface objects and functions


Sorry if I am asking a stupid question, i just want to be sure what to do you exactly mean by 2D interface. Do you mean SINGLE buffered roscreen which implements ifDraw2D?

Thanks.
0 Kudos
NewManLiving
Level 7

Re: single buffer vs double buffer roscreen

The roScreen implements the 2d interface as well as roBitmap and roRegion. All objects that implement the ifDraw2D interface make up the 2d. Along with those objects is roCompositor and roSprite for creating, layering and drawing sprites. A Sprite is simply a specific region of a bitmap that you want to place somewhere on the screen. Since sprites have a Z order they can be layered. The compositor handles the drawing of all its sprites in the Z order defined. roRegion does implement the ifDraw2D interface but is not documented very well.
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
bcoding
Level 7

Re: single buffer vs double buffer roscreen

"NewManLiving" wrote:
The roScreen implements the 2d interface as well as roBitmap and roRegion. All objects that implement the ifDraw2D interface make up the 2d. Along with those objects is roCompositor and roSprite for creating, layering and drawing sprites. A Sprite is simply a specific region of a bitmap that you want to place somewhere on the screen. Since sprites have a Z order they can be layered. The compositor handles the drawing of all its sprites in the Z order defined. roRegion does implement the ifDraw2D interface but is not documented very well.



Thanks a lot for your time and these valuable information.
0 Kudos
TheEndless
Level 7

Re: single buffer vs double buffer roscreen

This would be much easier to do using the new SceneGraph SDK. You may need to request early access if you don't have a Roku 4 which is already running 7.0 firmware.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
bcoding
Level 7

Re: single buffer vs double buffer roscreen

"TheEndless" wrote:
This would be much easier to do using the new SceneGraph SDK. You may need to request early access if you don't have a Roku 4 which is already running 7.0 firmware.



Thank you for the info.
0 Kudos