In this blog entry we'll build H/W accelerated version of MonoGame.Tetris example for Raspberry PI.
Raspberry PI does not have HW OpenGL libraries for accelerated graphics, instead it has OpenGL ES 2.0 libraries (and ES 1.1 embedded in same libraries) for acceleration. However it's possible to run OpenGL applications on RPI, but rendering will fallback to software OpenGL renderer (Mesa).
By default MonoGame for Linux uses OpenGL and can be executed with few tricks, but performance is not good.
I've baked an experimental MonoGame (based on MonoGame 2.0) for OpenGL ES 2.0 based desktop environments, in practice implementation was only about mixing Android GLES and Linux versions of MonoGame, so I don't take any credits for this :)
There's now also fork of MonoGame 3d in GitHub. Start observing it, since it's based on forthcoming release on MonoGame which has a lots of new cool features :)
MonoGame 3d for RPI is now out, check out: http://www.youtube.com/watch?v=jwbYe6eoZgE&feature=youtu.be
Here's a short checklist for running prebuild Tetris which is available as tetris_raspberry.gles2.zip at the end of this page.
After the required software has been installed start X, open terminal, and "cd" into directory that tetris_raspberry_gles2.zip is unpacked and type:
Reason why I'm using the Debian 6 instead of 7/Wheezy is that Mono seems have issues handling floating points on ARMHF (hardware floating point architechture).
I've been using MonoDevelop 18.104.22.168 and Windows 7 to build the project.
Make sure build target is set to Net 3.5 in MonoGame and Tetris projects, since Mono 2.6 does not support Net 4.0.
First we need to checkout source code for the modules:
Compile MonoGame against OpenTK and then Tetris against MonoGame, if you were lucky there were no errors, just
lots of meaningless warnings :)
Copy the compiled binaries to Raspberry PI.
We need also to copy VideoCore GPU libraries to folder were compiled binaries are from /opt/vc/lib. Copy libEGL.so and libGLESv2.so.
This step is not needed if you trying prebuild Tetris, since tetris_raspberry_gles2.zip already has patched libEGL.so included.
Default Raspberry PI VideoCore OpenGL ES drivers (/opt/vc/lib) does not support attaching into X11 surface, and
we need to tweak one of GLES library (libEGL.so) file to get things working.
This hack is not complete since it's hardcoded to create 800x600 window, so some work is still needed.
Now cross your fingers, and try executing Tetris.exe -- works for me :)
MonoGame sound system is based on OpenAL, so if you plan to use xna.SoundEffect (even without invoking play),
the following stuff is needed:
The last step is not necessarily needed on all distros, since sound module is probably preloaded.
That's it :)
Raspberry PI >