Running MonoGame on Raspberry Pi 3b+

So I want to use Mono Game for development of a Pi 3b+ app that will be the only app running on the device. I’ve configured the Pi with the Lite version of the OS (no Desktop).

I’ve looked at this tutorial:
https://medium.com/retrowax-games/how-to-run-your-monogame-app-on-a-raspberry-pi-or-any-linux-2bf93a4d4163

Which is a bit out dated and lacking with information on the Pi side, which is fine since it’s a couple years old and using an older .NET Framework.

I created the default App using DesktopGL. It should just display a window with the normal blue background, nothing special.

I publish the app and copy it to the Pi, when I run it, I get the error

Unhandled exception. Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device!
—> System.PlatformNotSupportedException: MonoGame requires either ARB_framebuffer_object or EXT_framebuffer_object.Try updating your graphics drivers.
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.FramebufferHelper.Create(GraphicsDevice gd)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformInitialize()
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Initialize()
at Microsoft.Xna.Framework.Graphics.GraphicsDevice…ctor(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, Boolean preferHalfPixelOffset, Presentatio nParameters presentationParameters)
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation gdi)
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()
— End of inner exception stack trace —
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice()
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice()
at Microsoft.Xna.Framework.Game.DoInitialize()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Program.$(String args) in \Program.cs:line 3
Aborted

I’ve gone into raspi-config and enabled the GL driver.

I would prefer to not have to install a Window Manager as this is going to be the only application running.

Has anyone run their app on a Pi in this configuration?

As an Update to this. I tried my other configuration that has the Desktop installed and the App runs fine. So I’m hoping I can just install a library on the other image and have it work without the Desktop starting.

I’m sorry I cant help but the problem sounds like one i had with a built in graphics card on a laptop with 2 cards (a gtx and an intel). The intel card would not work with monogame at all.

I wish you luck finding the library, it sounds like you’re solving it the right way.

You must have the X window system installed with OpenGL support.

It has been a few years since I did this please forgive any omissions.

Be careful with installing certain programs (kedit or gedit come to mind as they will install KDE or Gnome over your install)

I have omitted dbus on purpose, by that point install the full desktop and remove the window manager.

From: Xserver Xorg, Raspbian lite, and the blackbox desktop environment | Dustin John Pfister at github pages

sudo apt-get install xserver-xorg
sudo apt-get install xinit
sudo apt-get install x11-xserver-utils

Install Mesa (installation varies)
Install sound (installation varies)

Setup devices in Xconf text file under /etc

run startx & to start the server.
There should be a gray screen on 1,2 or 7.
To switch between screens press Alt-F1 or Alt-F2 … From the X-window screen it is Ctrl-Alt-F1.

Go back to the terminal.
export DISPLAY=:0.0
Run your game.

Remember there is no window manager(it simply renders), so full screen your game.

Good luck!

2 Likes

Thanks for that! I’ll be working on that later in the week.