views:

489

answers:

3

I'm using the VBO extension for storing Vertex, normal and color buffers (glBindBufferARB) For some reason when changing buffers or doing some operation the application crashes with an access violation. When attaching The debugger I see that the crash is in some thread that is not my main thread which performs the opengl call with the execution in some dll which is related to the nvidia graphics driver.

What probably happened is that I gave some buffer call a bad buffer or with a wrong size. So my question is, how do I debug this situation? The crash seem to happen some time after the actual call and in a different thread.

A: 

I think you may just have to brute force that one. I.e. comment out any vbo using lines a few at a time till your program doesn't crash anymore. Then you'll have an idea of which lines to focus your attention on and really scrutinize the parameters you're passing.

Also try sprinkling glError() calls liberally around your program. Often if you pass a bogus parameter glError will tell you something is wrong before it gets to the point of crashing.

Baxissimo
A: 

One of the best OpenGl/D3D debugging tools is nVidia's NvPerfHUD. It won't help you find your exact problem, but it does provide another view of what you are sending into the rendering pipeline.

However, I will say that I've only used it with D3D applications so I don't know if it helps as much with OpenGL programs.

EDIT:

I'm not sure why this got voted down. I have debugged VB and IB problems with NvPerfHUD before. Simple things such as bad primitive counts and be diagnosed by looking at each individual draw call.

Torlack
NvPerfHUD is indeed Direct3D only, so it's of no use with OpenGL, which is what the question was about. I'd guess that's why you got voted down.
Baxissimo
NvPerfHUD is not the relevant tool for this question/problem.
Ashwin
+3  A: 

Assuming this is about Windows, NVIDIA has a GLExpert tool. It can print various OpenGL warnings/errors.

In some other cases, using [GLIntercept] (http://glintercept.nutty.org/) OpenGL call interceptor with error checking turned on can be useful.

If the tools do not help, well, then it's good old debugging. Try to narrow down the problem and locate what exactly causes a crash. If it's a NVIDIA specific problem, try installing different drivers and/or asking on NVIDIA developer forums.

NeARAZ