MonoGame on rPi (raspbian) Hardware Accelerated?

I’ve found some examples of people claiming to have somehow patched MonoGame to run on the Raspberry Pi using OpenGL ES, but I have been unable so far to find any definitive instructions on how to do this.

Does anyone here have any details on how this might be possible with a more recent version of monogame? My code is currently written for 3.6

Thanks,

Yes you can if you enable experimental opengl acceleration on Pi and set 128Mo min of GPU RAM.

I’ve got MonoGame in itself working well with the Pi, but i cannot for the life of me get audio working.
If i load a SoundEffect of SoundEffectInstance, i get a System.DllNotFoundException: soft_oal.dll
OpenAL is installed though:

pi@dashboard:~ $ dpkg -l libopenal1 libopenal-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  libopenal-dev: 1:1.17.2-4   armhf        Software implementation of the Op
ii  libopenal1:arm 1:1.17.2-4   armhf        Software implementation of the Op

What gives? Where does MonoGame look for this?

Any chance you can provide instructions for getting mini game installed and working on an RPi? I’M happy to help figure it out but I’ve been unable to get that far.

I don’t know if it’s related, but there was a thread on reddit that talked about OpenAL being an issue, and it’s solution. Hopefully it’ll help you as I can’t even get Monogame to work in the first place.

I started that thread on reddit :laughing:

Just today, i figured out the solution, that i posted on reddit. I’ll just write it here as well:
Compile openal-soft from git and reference the built libopenal.so in the Monogame.Framework.dll.config, that’s located in the same folder as your .exe.

Any chance you can provide instructions for getting mini game installed and working on an RPi

Sure!
What have you tried so far?

@esbenn Sorry to bug you i have issues / not understanding how monogame works.

Actually i created a project for Windows. Demo project, running flawlessly.

I would like to move it to Raspberry Pi (3B). This is not an OpenGL ES project. I’m simply using Microsoft.Xna.Input.Touch assembly as a gesture framework.

Latest Raspbian, with Mono is installed on the Pi. I have runned some winforms projects, so far so good.

In the scope of monogame:

  1. install monogame on the Pi: apt install libopenal-dev monoruntime
  2. copy my app to the Pi
  3. mono Game1.exe

And i get the famous message: “Unhandled Exception:
Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device! —> System.EntryPointNotFoundException: SDL_SetWindowResizable at (wrapper managed-to-native) Sdl/Window:SetResizable (intptr,bool)”

I guess Mono can’t find SDL library. I have libsdl2-2.0-0/oldstable,now 2.0.2+dfsg1-6 armhf installed.
My Monogame.framework.dll.config is not mentionning any arm platform.

Can you help me to troubleshoot my issue ?

Thank you VM

Sorry to bug you

No problem!
I think there’s a couple of things going on here.

Concerning the famous Unhandled Exception, you’re right - it can’t find SDL. I believe the package you need is libsdl2-dev. At least i get a System.DllNotFoundException: SDL2.dll unless that one is installed, but once i have that, it works without modifying the Monogame.framework.dll.config.

You don’t need to actually install Monogame, but i’d make sure to install the latest version of mono from here: Download - Stable | Mono. mono-runtime should be fine, but i think i’d install mono-complete just to be sure.

If you are going to use audio in your project, specifically the SoundEffectInstance, you’re gonna get in trouble, as the version of OpenAL in Raspbians repos is quite outdated. However, you can compile the latest version from source: GitHub - kcat/openal-soft: OpenAL Soft is a software implementation of the OpenAL 3D audio API.. You can then link to your compiled version of OpenAL in Monogame.framework.dll.config like this:

<dllmap dll="soft_oal.dll" target="/home/pi/Downloads/openal-soft/build/libopenal.so" />

That works for me, at least.

Not so sure about winforms - i actually thought that would rely on user32.dll and thus not work on the pi, but you got that working?

Concernong touch, i’m afraid i don’t know whether or how it works, as i have not used it.

Thank you VM !

Yes Winforms was a way to say i’m using mono regulary, but is not related to Monogame.

I’ll tell you if i can get it to work ! :wink:

Monogame is working on Raspberry 3B.
My trouble was related to SDL version which must be >= 2.0.5

Raspian Jessie is not providing such a compatible SDL (so the error message) which is 2.0.0
Raspian Stretch is providing correct SDL (2.0.5)
As today, it should work with actual SDL (2.0.8) but untested.

Nothing more than code on Windows, copy, run.
Sound not tested :slight_smile: but i keep the trick for OpenAL.

TYVM

Graveen, any chance you’d be willing to make an image of a rPI install with monogame working? I’ve had nothing but trouble getting it running.

Sorry did not notice your message. I no longer have monogames on the pi but my main issue was the bad SDL that was correct with Stretch.