ThuCommix / Sharpex2D

2D GameEngine for Indie games with alot of features
http://www.sharpex2d.de
MIT License
47 stars 9 forks source link

Unable to create OpenGL 3.3 context #48

Closed Kaskadee closed 8 years ago

Kaskadee commented 8 years ago

Sometimes when i start a game it works and sometimes i get following exception:

Sharpex2D.Framework.Rendering.GraphicsException: Unable to create OpenGL 3.3 context.
   bei Sharpex2D.Framework.Rendering.OpenGL.RenderContext.Initialize() in D:\Bibliotheken\Dokumente\GitHub\Sharpex2D\Sharpex2D\Rendering\OpenGL\RenderContext.cs:Zeile 111.
   bei Sharpex2D.Framework.Rendering.OpenGL.GLRenderer.Initialize(Game game) in D:\Bibliotheken\Dokumente\GitHub\Sharpex2D\Sharpex2D\Rendering\OpenGL\GLRenderer.cs:Zeile 70.
   bei Sharpex2D.Framework.GameLoop.Loop() in D:\Bibliotheken\Dokumente\GitHub\Sharpex2D\Sharpex2D\GameLoop.cs:Zeile 162.
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()
ThuCommix commented 8 years ago

I was investigating this problem back in a while and came to the conclusion that this happens only when debugging in VS and never when just running the .exe (like the enduser would do). The context creation fails because the extension method "wglCreateContextAttribsARB" which is needed to elevate the context to version 3.3 is not found. Strangely the most time (when debugging) its working. I don't have a proper explanation for this behaviour but as long it works when in release I guess we can live with it.

Kaskadee commented 8 years ago

Yeah, but it's a little bit annoying when trying to debug. But if it's a problem with VS, then you can't do anything against it.

ThuCommix commented 8 years ago

If anyone figure out why sometimes the extension method is not found in opengl.dll I will fix it.