1

I just installed MonoGame and OpenTK 1.0 and in Visual Studio 2012 I made a new project of type 'Windows OpenGL Game`...but when I run the project I get the following error:

The type initializer for 'OpenTK.Graphics.GraphicsMode' threw an exception.

The error is right on this line (the consturctor, on the base())

public Game1()
    : base() 
{
    graphics = new GraphicsDeviceManager(this);
    Content.RootDirectory = "Content";
}

My laptop has intel oboard graphics 3000 and I think it supports OpenGL...thats the only thing I can would point to. Any ideas?

Dumbo
  • 13,555
  • 54
  • 184
  • 288
  • Well it means there is an error in the constructor for the 'OpenTK.Graphics.GraphicsMode' class, do you have access to the constructor of the class? – Cyral Jul 20 '13 at 23:26
  • 1
    This answer will probably help you. Your laptop probably doesn't support the required version of OpenGL. http://stackoverflow.com/questions/14558256/unable-to-find-an-entry-point-named-glbindframebuffer-in-dll-opengl32-dll-i – craftworkgames Jul 21 '13 at 23:22

2 Answers2

1

We can look at the source code and find where the exception went unhandled. The "type initializer" basically means the static constructor:

static GraphicsMode()
{
    lock (SyncRoot)
    {
        implementation = Platform.Factory.Default.CreateGraphicsMode();
    }
}

Unfortunately digging through CreateGraphicsMode doesn't reveal any single obvious source for an exception.

What you should do now is try to get a stack-trace for that exception, and find out where it originates from within CreateGraphicsMode. The debugger should give you this information when the exception goes unhandled.


With a small amount of digging, without seeing a stack trace (so I'm pretty much guessing), I came across this potential culprit:

throw new GraphicsModeException(
    "No GraphicsMode available. This should never happen, please report a bug at http://www.opentk.com");

Which, of course, is extremely unhelpful. Although, based on its location, it would seem to indicate that it cannot find a suitable graphics mode.

At this stage, I think it would be best to build MonoGame and OpenTK from source so that you can use the debugger to see exactly what they're doing.

Andrew Russell
  • 26,924
  • 7
  • 58
  • 104
  • well I just think its my laptop garphics chip...on my pc everything goes fine – Dumbo Jul 25 '13 at 19:34
  • For posterity, OpenTK will now correctly fallback to a software-accelerated context if hardware-acceleration is not available. This is slow but it avoids the crash. – The Fiddler Mar 27 '15 at 17:32
0

This issue was happening to my as well, and I do not believe it's MonoGame's source code issues.

A) You need to make sure openTK is insstalled, http://www.opentk.com/

B) Like craftworkgames said, your machine (laptop I'm assuming) doesn't support OpenGL. I had this issue on my Sufrace Pro, and had to update my Intel drivers to the latest (I used guru3d.com and www.guru3d.com/files_categories/videocards_intel_graphics_drivers.html at this time installed the 15.31 drivers) and then it started working.

Mastro
  • 1,477
  • 2
  • 22
  • 52