
GL.GenBuffers hits Invalid Operation Error
Posted Friday, 14 December, 2012 - 11:41 by LloydP inI am trying to convert a WebGL app to a native Win Forms app using OpenTK.
When I try to create my VBOs, I am getting a GL Error of Invalid Operation for GL.GenBuffer.
My first thought was the app is running in a really old version of OpenGL that doesn't support VBOs, So I told it to try a 3.0 context, and still no joy.
I am running Windows 8, VS2012, .net 4.5 and my gfx card is an nVidia 250 GTS. OpenTK claims I'm able to support up to OpenGL 3.3.
When I push my points to the gpu manually, it works, but bearing in mind this has come from WebGL, everything is setup to batch into mega VBOs, I'd like to use them for a) performance and B) keeping the two code bases similar for maintainability.
Any suggestions where I might be going wrong?
(PS. Is there a way to use ES20 on a desktop? It would be better for me to use that as it would match up more with WebGL)


Comments
Re: GL.GenBuffers hits Invalid Operation Error
VBOs work for sure, you can't expect help without posting some code ;-)
also
ES20 runs inside chrome using ANGLE ( http://code.google.com/p/angleproject/ )
Re: GL.GenBuffers hits Invalid Operation Error
Ok, well here's my Layer class converted to c#.
Essentially, I'm loading up a pretty large 3D CAD model. The geometry is static, but there's a metric fuck-ton of it, so for performance I need to follow the nvidia school of batch, batch, batch.
What I do (in webgl to minimise gl calls) is to split the model into layers by 'material' type which is essentially RGBA colour. I then push each item (eg a door or a wall) into a 'mega VBO' which contains the geometry for all items of that material type. This means I only call DrawArray something like 20x for a model with 10,000 meshes in it. This means performance is O(m) where m is the number of materials in the model.
When I convert my javascript to c# and use opentk, it's failing in CreateVBO() at GL.GenBuffers()
Help very much appreciated. Thanks in advance, and thanks for the ANGLE suggestion. I was aware it was used for webgl, but didn't realise I could drop the dlls in and use it for my GLES 2 stuff too!
Re: GL.GenBuffers hits Invalid Operation Error
OK - I feel like a real tool. Problem solved.
The problem wasn't actually related to VBOs at all, there was a previous GL Error thrown, and the first time I called for errors was after I created my VBOs.
Thanks.