townsend
Posts: 6
Joined: Sun Aug 16, 2015 11:07 pm

bit map in memory

Sun Aug 16, 2015 11:31 pm

I have an application written for OpenGL on an Ubunutu system which continuously renders a bit map image held in RAM to the screen. The "graphics programming" in this application is done at the lowest level by manipulating bits in RAM for efficiency. I need to snap these bitmaps up on the screen as fast as possible. In my existing application, I use textures to do this. It is a full screen (say 1024X1024) 24 bit color image.

What is the absolutely fastest way I can pump each frame out on a Raspberry PI2 when I've got a new frame ready to go? In my existing application I use the blocking swap buffers call to synchronize with the monitor. I've been told that's automatic on the PI. I need to render these frames at 60Hz. Can a PI handle this job, and if so, can someone give me some example code to play with? Thanks.

User avatar
dividuum
Posts: 225
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: bit map in memory

Thu Aug 20, 2015 11:37 am

You might ditch OpenGL and use the lower level dispmanx interface for that. The idea is to create a new dispmanx layer for your image data and update that each frame. I don't have any experience how fast you'll be able to update that, but it might be worth a try. For example code, have a look at /opt/vc/src/hello_pi/hello_dispmanx/dispmanx.c. While this only draws a single bitmap to the screen the process is similar. The seems to be no manual for dispmanx, so try searching for example code that uses 'vc_dispmanx_resource_write_data'. I'm also not sure what color formats other than RGB565 are supported.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: bit map in memory

Fri Aug 21, 2015 12:16 am


townsend
Posts: 6
Joined: Sun Aug 16, 2015 11:07 pm

Re: bit map in memory

Sun Mar 13, 2016 1:16 am

Thanks for the replies. I found some code that let me set up a direct pointer into video memory, and also allowed me to synchronize my work with the vertical sync of the PI's video output. What was once a mess of convoluted hybrid OpenGL code combined with C suddenly collapsed into an elegant, compact, lightning fast solution. So, I'm good now.

Return to “OpenGLES”