kwizatz's picture

Unbalanced stack on Ortho call

I am getting a PInvokeStackImbalance error at runtime when calling OpenTK.OpenGL.GL.Ortho on
Interestingly enough, this happens on Visual C# 2005 Express and apparently not on Visual C# 2005 Standard.

Could be the machine's drivers though.

here is the Message I get:

PInvokeStackImbalance was detected
Message: A call to PInvoke function 'OpenTK!OpenTK.OpenGL.GL+Delegates+Ortho::Invoke' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Any ideas what could it be?


PS: I tried using glFrustum but got the same error, all other OpenGL calls seem to run fine.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kwizatz's picture

Ok, More info, it seems to be a warning rather than an error as the program continues execution after I receive the notice.
The only suspicious change I see from the older version I was using is the change from GLdouble arguments to Double ones.

This may or may not have some relation with my other problem which I described in my previous post, I check and I am making no calls to GetFloatv between begin/end calls.

the Fiddler.'s picture

It is quite possible that a bug crept in during all the changes to the GL class, I'll search deeper.

kwizatz's picture

Great, thanks, I tried to find a solution, but I really wouldn't know where to start, I am not that familiar with C# yet.

the Fiddler.'s picture

I haven't been able to reproduce the issue yet, but the latest OpenTK version (0.3.11) fixes a stack corruption issue. It might be that these two are linked somehow, can you test and see if the bug still exists?

If an exception is still thrown, can you give some more on the operating system, graphics card, drivers and .Net/Mono version you are using? A small code sample that reproduces the issue would be nice, too!

kwizatz's picture

0.3.11 seems to fix all of my problems, thank you very much, excellent work!
I'll post again if something else pops up.