This project is read-only.

Extension function glGenBuffers not supported

Mar 5, 2013 at 12:37 AM

I'm trying to use VBOs with SharpGL and get this exception: "Extension function glGenBuffers not supported" for this: gl.GenBuffers(BUFCNT, ids);
  • I have a dual gpu notebook with a GeForce GTX660M and Intel HD Graphics 4000, both have the latest drivers, both fail the same way
  • I have Windows 7 Pro x64 with all the updates
  • I tried both FBO and DIBSection as RenderContextType
  • I use SharpGL 2.0 with VS2010 and .NET 4.0
What am I missing?

Thanks for your help.
Mar 5, 2013 at 12:11 PM

In the SGL source code, there is a utility that lists supported extensions for a system, can you check with that to see whether it says it's supported? It should be available for your system if you are using an FBO render context ...
Mar 5, 2013 at 12:53 PM
The glGenBuffers extension function shows up as supported for both cards.

(By the way, is it normal, that with DIBSection as RenderContext, the rendering is more than 3 times faster?)
Mar 5, 2013 at 4:37 PM

I tried it on other computers and it didn't work there either.

However, I started a new SharpGL project and copied this example into it, and that didn't throw an exception, so something is messed up in my project.

But the example doesn't compile as-is, I had to change the parametrization of DrawElements like this:
IntPtr ptr = GCHandle.Alloc(indices, GCHandleType.Pinned).AddrOfPinnedObject();
gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_FLOAT, ptr);
Now the program runs, but doesn't show anything. How should that be used?

Mar 5, 2013 at 6:54 PM
Oh, I'm an idiot, the 3rd parameter os drawelements is the type of the indices, not the vertices, so it works like this:
IntPtr ptr = GCHandle.Alloc(indices, GCHandleType.Pinned).AddrOfPinnedObject();
gl.DrawElements(OpenGL.GL_TRIANGLES, indices.Length, OpenGL.GL_UNSIGNED_INT, ptr);
Now I'll try to create a new project and copy my sources over, I hope that will fix my project as well.
Mar 5, 2013 at 9:46 PM
I think I know what was the problem.

I'm loading my models in a background worker thread, so the call to GenBuffers was made by that one, and it didn't like it. :D

Now I pass the Dispatcher of the main window and do the buffer generation in a
guiDispatch.BeginInvoke( (Action)(() =>
}), null);

So far it seems to be working.
Aug 14, 2013 at 9:01 PM
Hey there,

first of all, I'm very thankful for having this library. It wraps all OpenGL functionality, so you guys saved me loads of work!

One thing just freaks me out though: when I create a WPF SharpGL project, I get 2.0 references, and when I add SharpGL as a Nuget package to a class lib, it adds 2.1, which contains some methods with different signature. I thought to be overcoming this trouble by starting with a normal WPF project and adding the Nuget package (2.1).

This seemed to work and I moved all hello world code from my 2.0 SharpGL application to a more structured class lib with SharpGL 2.1. Then when I started using these clasess my normal WPF program with a 2.1 Nuget package, OpenGL.CreateProgram failed with the exact same error as the one krajcsovszkig started this thread about: "Extension function.... not supported".

Why is this OpenGL function not supported in this newer version of SharpGL? I mean, as far as I know it is still pretty much in use for creating bundles of custom vertex and fragment shaders (which I'm doing). Could anyone help me out?

Thanks in advance, benzhi
Aug 15, 2013 at 4:45 AM
Ok, so now I'm out of ideas:
  • I removed all 2.1 packages with Nuget package manager
  • Created a local libraries directory containing 2.0 libraries
  • Referenced SharpGL 2.0 from the local directory
  • Fixed the signature mismatch I encountered on OpenGL.ShaderSource
  • Rebuilt all code and ran the application with 2.0 references and gues what: Extension function glCreateProgram is not supported
  • I finally checked all references but they match the WPF SharpGL project that runs with the given function
So, what is going on? Am I using a different version of OpenGL or any other unmanaged piece of software underneath without having knowledge of it? And how can I detect this? Maybe I've got to check it with Process Explorer?