luca-piccioni / OpenGL.Net

Modern OpenGL bindings for C#.
MIT License
568 stars 108 forks source link

"invalid enumeration" exception while initializing winforms component in Sample projects #83

Closed xandrmoro closed 6 years ago

xandrmoro commented 6 years ago

Call stack: OpenGL.Net.dll!OpenGL.Gl.CheckErrors() Line 499 C# OpenGL.Net.dll!OpenGL.Gl.DebugCheckErrors(object returnValue) Line 511 C# OpenGL.Net.dll!OpenGL.Gl.Get(int pname, out int data) Line 6934 C# [External Code] OpenGL.Net.dll!OpenGL.Gl.Limits.Query(Khronos.KhronosVersion version, OpenGL.Gl.Extensions glExtensions) Line 131 C# OpenGL.Net.dll!OpenGL.Gl.Initialize() Line 142 C# OpenGL.Net.dll!OpenGL.Gl.Gl() Line 54 C# [External Code] OpenGL.Net.dll!OpenGL.DeviceContext.DeviceContext() Line 47 C#

pname in Get method equals to 34827, Gl.CurrentVersion is 4.6.0. Win10 x64.

I was able to reproduce it in the standalone project with dll's built from source, but there is no such exception while using NuGet version.

How can I overcome this?

luca-piccioni commented 6 years ago

The exception should be masked at that call stack, indeed a Continue debugger command should let the continue the execution.

Probably your driver do not manage correctly the GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB enumeration, but your driver advertize support for ARB_fragment_program.

When using the NuGet, no error checking is performed automatically, indeed the observed behavior.

xandrmoro commented 6 years ago

"Continue" keeps stuck here somewhy.

So just ignore this? (btw, there is no such problem using WPF)

luca-piccioni commented 6 years ago

Probably other sibling enums cause GL_INVALID_ENUM returned by glGetError. Just ignore them.

What is your GPU?

luca-piccioni commented 6 years ago

I think you can configure the debugger to avoid breaking execution on managed/caught exceptions of type GlException.

xandrmoro commented 6 years ago

GTX760 with latest driver.

Btw, switching to release and back to debug somehow made exception to disappear, so probably it was some king of glitch.

Thank you anyways! :)