NoSuitableGraphicsDeviceException on Virtual Machine
Closed this issue · 2 comments
Prerequisites
- I have verified this issue is present in the
develop
branch - I have searched open and closed issues to ensure it has not already been reported.
MonoGame Version
MonoGame 3.8.1.303
Which MonoGame platform are you using?
MonoGame Cross-Platform Desktop Application (mgdesktopgl)
Operating System
Windows 10 in VirtualBox
Version 5.1.22 r115126 (Qt5.6.2)
Description
NoSuitableGraphicsDeviceException on Virtual Machine
Steps to Reproduce
Game1.cs
using System.Collections;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace KNT;
public class Game1 : Game
{
Texture2D ballTexture;
GraphicsDeviceManager _graphics;
SpriteBatch _spriteBatch;
ArrayList ALEnemies;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
_graphics.GraphicsProfile = GraphicsProfile.HiDef;
Content.RootDirectory = "Content";
IsMouseVisible = true;
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
ALEnemies = new ArrayList();
_graphics.PreferredBackBufferHeight = 768;
_graphics.PreferredBackBufferWidth = 1024;
_graphics.ApplyChanges();
base.Initialize();
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
_spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game content here
ballTexture = Content.Load<Texture2D>("ball");
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
// TODO: Add your update logic here
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
_graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
_spriteBatch.Begin();
_spriteBatch.Draw(ballTexture, new Vector2(0, 0), Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
}
Program.cs
using var game = new KNT.Game1();
game.Run();`
Minimal Example Repo
Expected Behavior
Program working when launched like inhttps://monogame.net/articles/getting_started/4_adding_content.html
Resulting Behavior
Run the program from VS Studio ang get Exception has occurred: CLR/Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException
How so? Other programs work
Files
Project is KNT\KNT\KNT.csproj
This is not a MonoGame issue. When running 3D graphics from a virtual machine, the machine needs additional drivers and software in order to support 3D rendering.
You might want to look into how to enable OpenGL rendering in VirtualBox. Bear in mind that depending on your host machine and system, it might not be possible, some combinations just don't work.
I understand. Thanks for answer.
Temporary solution: put Mesa3D OpenGL DLL along with .exe of project