I'm trying to create a cross-platform MonoGame project on Linux. However, the application fails to run - it throws a NoSuitableGraphicsDeviceException. I have no clue as to what causes this. Does it have something to do with graphics drivers?
Here's the stack trace:
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)
at Microsoft.Xna.Framework.SdlGameWindow.CreateWindow () [0x00098] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.PlatformInitialize (Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x000d8] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00023] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00011] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00036] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice () [0x00000] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00016] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at MaijaSokoban.Program.Main () [0x00007] in <ffbdf0478cf84377b5ca9b241123624d>:0
[ERROR] FATAL 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)
at Microsoft.Xna.Framework.SdlGameWindow.CreateWindow () [0x00098] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.PlatformInitialize (Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x000d8] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00023] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00011] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00036] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice () [0x00000] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00016] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at MaijaSokoban.Program.Main () [0x00007] in <ffbdf0478cf84377b5ca9b241123624d>:0
Here's all of my code:
// Program.cs
using System;
namespace MaijaSokoban
{
public static class Program
{
[STAThread]
static void Main()
{
using(var game = new MaijaSokoban())
game.Run();
}
}
}
// MaijaSokoban.cs
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace MaijaSokoban
{
public class MaijaSokoban : Game
{
private GraphicsDeviceManager graphics;
private SpriteBatch spriteBatch;
public MaijaSokoban()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}
}
}