IL replacement failure, Tao.Platform.Windows.Wgl.wglGetSwapIntervalEXT
Submitted by Rick on November 20, 2007 - 9:58pm.
People,
I am learning Opengl as replacement of DirectX. By using of wgl a have a content created and ask for the extension pointer:
if (Tao.OpenGl.Gl.IsExtensionSupported("WGL_EXT_swap_control"))
{
IntPtr pointer1 = Tao.OpenGl.Gl.GetFunctionPointerForExtensionMethod("wglSwapIntervalEXT");
This "IntPtr" pointer is not zero.
After that i call:
Tao.Platform.Windows.Wgl.wglGetSwapIntervalEXT(pointer1);
but generate an error " IL replacement failure."
What is going wrong?

Known bug. You have to
Known bug. You have to update to the latest SVN (from sourceforge) to get working Wgl extensions.
Edit: oops, that's not in yet.
@devs: Are we ok with updating the Tao.Platform.Windows.Wgl bindings to the ones produce by the generator? We lose inline documentation, but we gain support for Wgl extensions which are broken now.
------
OpenTK
Yes. Update to the latest
Yes. Update to the latest version of the Wgl bindings.
Thanks for the answers, But
Thanks for the answers,
But it is not clear for me what for update is needed.
I have update my graphics drivers and i use the last Tao software 2.0.0. But how can i update the Wgl bindings?
Rick
It´s a problem on the Tao
It´s a problem on the Tao part - give me a few hours, I´ll update the bindings and post a beta version here. You´ll just need to replace the existing Tao reference in your project with the new assembly.
------
OpenTK
I'd like a copy of that beta
I'd like a copy of that beta version as well, when you can get it posted.
I've uploaded it to
I've uploaded it to here.
When you need to call extension functions, you'll probably need to call Wgl.ReloadFunctions() after you have an active GL-context.
@Stapostal (and others)
I've run GlBindGen, tweaked glHelper a bit and added this to SVN to replace the old Wgl.
There is a build problem
There is a build problem with Tao.Platform.Windows when building the NeHe examples 14 and 15:
Error 1 'Tao.Platform.Windows.Wgl' does not contain a definition for 'WGL_FONT_POLYGONS' C:\data\taoframework\examples\NeHe\Lesson15.cs 206 21 NeHe
It works, thanks! However, I
It works, thanks!
However, I notice now that Tao.OpenGl.Gl.IsExtensionSupported("WGL_EXT_swap_control") always returns false on my machine. Is that correct? Since I don't seem to need Tao.OpenGl.Gl.GetFunctionPointerForExtensionMethod() anymore, are we supposed to just call it, and take the return value as indication of success?
No big deal for me one way or the other, though. I'm just programming for fun and wanted vsync as a way to control CPU usage. Thanks again.
Oh-oh, seems like I wanted
Oh-oh, seems like I wanted to go a little too fast.
I'll check it out!
Update:
I've added a Wgl.IsExtensionSupported(), that should solve your problem, updated file above. Nehe is also fixed.