mnstrmnch
Posts: 3
Joined: Mon Sep 10, 2012 9:38 pm

Letterboxing with vc_dispmanx

Mon Sep 10, 2012 9:44 pm

Hi,

I have an application that I want to run in a fixed aspect ratio regardless of native screen resolution. To do this I am specifying appropriate src/dest rectangles to vc_dispmanx_element_add so that there are gaps at the top and bottom of the screen. This works fine, however the underlying console is still visible in the gaps. Is there a way to disable the console plane or some other way to make the gaps blank?

Thanks,
Pete

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5502
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Letterboxing with vc_dispmanx

Mon Sep 10, 2012 10:05 pm

There's a few ways. You could create extra back dispmanx objects for the black bars to obscure the console. Remember you can scale up a small black square to be a little more efficiient.

More efficient is to run clear first. You may also want to disable cursor:

Code: Select all

clear && setterm -cursor off  && ./myapp
Changing tv mode does delete the console layer.

Code: Select all

/opt/vc/bin/tvservice -o && /opt/vc/bin/tvservice -p
will have the side effect of removing the console. You can get it back with:

Code: Select all

fbset -depth 8 && fbset -depth 16

mnstrmnch
Posts: 3
Joined: Mon Sep 10, 2012 9:38 pm

Re: Letterboxing with vc_dispmanx

Mon Sep 10, 2012 11:32 pm

Thanks for the reply, dom.

I managed to get it working with dispmanx using a black 1x1 resource stretched over the gaps as you suggested :)

Thanks,
Pete

Return to “OpenGLES”