Setting attribute data, randomly returns bad access exception

Hi there,

I’m computing tangent space and setting it to my shader as an attribute like so:

shader.begin();
int location = shader.getAttributeLocation("tangent");
earth.getVbo().setAttributeData(location, &tangents[0], 3, tangents.size(), GL_DYNAMIC_DRAW, sizeof(ofVec3f));
shader.end();

What happens is, it randomly (maybe 1 out in 5) returns a bad access exception, from this function:

glBufferData(this->data->lastTarget, bytes, data, usage);

I’ve no ideia why, or how to solve this. But when it successfully builds, everything works as expected.

I’ve tried in master and 0.9. I’m using Mac OS 10.11, but it was also happening in 10.10.

I’m having a very similar issue but my crash is at glDrawElements. I believe there is a GL leak somewhere in my app but cannot spot it.

It crashes when I use ofVboMesh::setAttributeData. It eventually (after several loops) crashes in random glDraw functions. Is there any example out there on how to properly use and set custom attributes on ofVboMesh?

Is ofVboMesh designed so that we can access the underlying ofVbo and freely set attributes?

1 Like

Hi there,

Not sure if I can help you. :confused: Last week I had to do a clean install of OSX, and the random crashes seem to have disappeared. Dunno why.

OF comes with an example (gl > billboardRotationExample) that might be useful to you.

That one uses ofVbo directly, I was wondering whether ofVboMesh could work differently.

Thanks anyways!

ofVboMesh is a combination of ofVbo with ofMesh for easier interface. Like so, it works exactly the same:

yourVboMesh.getVbo().setAttributeData(...);
1 Like

yes that should be fine. if you have called at least once setAttributeData and just need to change the data without changing the size, it’s usually better to call updateAttributeData instead. also if you call updateAttributeData on a buffer with smaller size it can crash

2 Likes

I’ve just been able to reproduce the error I’m getting with a inimal example (sounds a lot easier than it is).

I believe this is a problem specific to Nvidia drivers on windows. This is tested only on 0.8.4 but I believe it should also happen on 0.9.0. Will test soon.

What the app does is creating and deleting a custom ofVboMesh with a very simple layout, setting attribute data (not actually used).

vboLeakApp.zip (5.5 KB)

Just tested with latest github snapshot and it does crash. Maybe I’m doing something crazy on the uploaded app, but I think it should be fine, actually if I comment the setAttribute line it does not crash.

Can anyone confirm whether it crashes on other machines or platforms?

i’m testing it in linux and it’s ok how often do you see the crash?

Testing on Windows, with AMD Radeon HD 7770 (15.12), not crashing.

It seems that Nvidia is not hiding the error.

@arturo are you using amd or nvidia?

For me it crashes instantaneously.

Windows 7 64
Nvidia GTX 660, driver version : 353.90

weird, i have to test a couple of things in windows tomorrow will take a look at this. can you also open an issue in github? that way other people who are maintaning opengl can check it too

1 Like

Done. I’m testing on another machine soon.

Update: Crashes also on Windows 10, Nvidia GT 750m

Actually, still crashing. OSX 10.11.3, AMD Radeon HD 6750M.