So I'm trying to run an extremely barebones OpenTK program -- basically the quickstart program (which worked), but with VBOs/IBOs instead of immediate mode.
I generate a grid of vertices, and associated indices. For testing purposes, that grid is currently statically set to just a 2x2 quad, and the vertices/indices check out when I debug it. If I draw the vertex buffer with GL.DrawArrays, it also works, albeit with some massaging to get it to look right. However, the moment I try to call GL.DrawElements, the entire program crashes, with the worst driver error I have ever seen:
"Too many errors occurred, which indicates a serious problem from which we cannot recover. The application must close."
NVIDIAs site help doesn't really target developers, so none of the information is very helpful to me. Plus, I'm fairly sure my drivers shouldn't have a problem with IBOs no matter how old they are (and I updated them just in case). So, I'm pretty sure despite the contents of the error and the literature on it, it's a problem with the program. I can't seem to figure out what though, since the problem is stupid simple.
Code is below:
I'd appreciate if anyone could see if I'm missing anything.
EDIT: After about 3 hours, I've figured something out. Not sure why it's correct, but it is:
//GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedShort, indices);
//should be
GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedShort, (IntPtr)(0));