[vtkusers] hardware acceleratec OpenGL on Raspberry pi 3/Raspbian?

Ken Martin ken.martin at kitware.com
Wed Apr 20 08:34:15 EDT 2016


Very cool Elvis! Amazing what these tiny systems can do.

On Tue, Apr 19, 2016 at 11:01 PM, Elvis Chen <elvis.chen at gmail.com> wrote:

> hi all,
>
> This is a status update on vtk on Raspberry pi, with hardware accelerated
> OpenGL.
>
> After a few days of trial and error, I managed to get VTK working on
> Raspberry Pi 3. I hope my experience can save others some time, as
> information on the web can be misleading.
>
> First of, I am using Raspberry Pi 3.  The DOs and DONTs
>
> DO:
> - make sure you use the official PSU (rated at 2.5A), as there are reports
> that an under-powered PI causes OpenGL driver to fail,
>
> DONTs:
> - don't use the official 7" touch screen. The OpenGL driver apparently is
> very picky on the output format. It won't work with the 7" touch screen
> - don't follow the instruction on
> https://www.raspberrypi.org/blog/another-new-raspbian-release/, in
> particular DO NOT UPGRADE Raspbian.
>
> Here is what I had to do to get hardware accelerated OpenGL to work:
>
> - create a new raspbian/Jessie bootdisk using 2016-03-18 image
> - upon first boot, which boots into X by default, expand the file system
> using Menu->Preference->Raspberry Pi Configuration. Reboot
> - upon 2nd boot, change keyboard/time-zone as desired. Using the same
> configuration utility as the previous step, change the boot option to "To
> CLI" instead of "To Desktop". Reboot.
> - now raspbian will boot into commandline instead of X. Issue the
> following command:
>      sudo raspi-config
>      - under Advanced Options, Enable OpenGL driver, reboot
> - once rebooted, issue "startx"
> - open a terminal, issue the following command
>      sudo apt-get update
>      sudo apt-get install libvtk5-qt4-dev cmake cmake-curses-gui mesa-utils
>
> I choose vtk5 but vtk6 is also available as a pre-compiled package.
>
> - with mesa-utils installed, you can run glxgears to test opengl. I am
> getting 59FPS on RPi3
>
> pi at raspberrypi:~/research/bin/vtkViewPolyDataMesh $ glxgears
> Running synchronized to the vertical refresh.  The framerate should be
> approximately the same as the monitor refresh rate.
> 293 frames in 5.0 seconds = 58.548 FPS
> 301 frames in 5.0 seconds = 59.994 FPS
> 299 frames in 5.0 seconds = 59.613 FPS
> 290 frames in 5.0 seconds = 57.999 FPS
> 300 frames in 5.0 seconds = 59.807 FPS
> 300 frames in 5.0 seconds = 59.995 FPS
>
>
> - I have compiled my own VTK program that displays a vtkpolydata and it
> runs well. I'll be making a video and post it online in a few days.
>
> Again, please not that while I "updated" the apt packages, I NEVER
> "upgraded" any. I needed to "update" in order to install additional
> programs, but an "upgrade" will brake the OpenGL driver.
>
> Hope this helps
>
> --
> Elvis C.S. Chen, PhD
>
> Imaging, Robarts Research Institute
> Department of Electrical & Computer Engineering
> Biomedical Engineering
> Medical Biophysics, Western University
> London, Ontario, Canada
>
>
>
> On Sat, Apr 16, 2016 at 8:36 PM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> Hi Elvis,
>>
>> One way of checking the OpenGL driver is the "glxinfo" command.
>> The "OpenGL renderer" is usually Mesa if it is a software renderer,
>> but if it gives the name of a specific card or chip, then you probably
>> have hardware rendering, e.g. here's what my laptop reports:
>>
>> OpenGL vendor string: NVIDIA Corporation
>> OpenGL renderer string: NVIDIA GeForce 9400M OpenGL Engine
>> OpenGL version string: 2.1 NVIDIA-8.24.17 310.90.9.05f01
>> OpenGL shading language version string: 1.20
>>
>> I don't know much about the Raspberry Pi, but google found this
>> page that describes how to enable hardware OpenGL:
>> https://www.raspberrypi.org/blog/another-new-raspbian-release/
>>
>>  - David
>>
>>
>> On Sat, Apr 16, 2016 at 6:06 PM, Elvis Chen <elvis.chen at gmail.com> wrote:
>>
>>> Greetings,
>>>
>>> I've recently acquired a Raspberry Pi 3. To my surprise, the latest
>>> raspbian (Jessie) comes with a complete development environment, including
>>> gcc (4.9), cmake, and vtk (both vtk5 and vtk6).
>>>
>>> I wrote a small program that reads a polydata and display it as a test
>>> bed. The pipeline is:
>>>
>>> vtkpolydatareader->vtkpolydatamapper->vtkactor
>>>
>>> nothing fancy.
>>>
>>> However, the rendering is surprisingly SLOW. It looks if the graphics is
>>> not hardware accelerated.
>>>
>>> My questions are:
>>>
>>> 1) How do I check if the video (which I assume to be OpenGL) is hardware
>>> accelerated?
>>> 2) any suggestion on how to optimize the performance?
>>>
>>> My next step is to comple vtk myself to see if it makes any difference.
>>>
>>> any help is very much appreciated,
>>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160420/0f68194d/attachment.html>


More information about the vtkusers mailing list