-
Notifications
You must be signed in to change notification settings - Fork 340
[GL] fix segfault when drawing Rigid3d frame #5718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[GL] fix segfault when drawing Rigid3d frame #5718
Conversation
|
Hi Paul, Thank for fixing that, for the moment I don't quite understand the problem and the fix, so unless someone understand that please wait for fastmerge. NB: I just noticed that the frame drawing has caching mechanisme.. but as you are now using adresses ... I wonder if there is no risk of fill the cache too fast. Maybe a maximum-cache parameters with auto cleaning the least recently used frames. EDIT: I tried the example and didn't managed to reproduce the problem. |
|
In case the issue is confirmed... (i was not able to reproduced) I made this PR bakpaul#37 to avoid the use of pointer's which are not stable. Actually I'm a bit confused by the purpose of this caching mechanisme... caching by pointers means that same adress render the same ? Even if the frame moved ? |
|
Hi @bakpaul, I also have problem on crashes related to rigidframe rendering. Actually I don't also understand the logic of the caching system. |
|
Hi @bakpaul I think the problem is not related to how the caching system (which is still think look very weird to me... ) but to the line: glDrawElements(GL_TRIANGLES, comp.triangle_count * 3, GL_UNSIGNED_INT, comp.triangles );Because struct Triangles {int v0, v1, v2} and not uint so it should be reinterpreted and correctly typed as in: glDrawElements(GL_TRIANGLES, comp.triangle_count * 3, GL_INT, reinterpret_cast<const int*>(comp.triangles) ); |
|
@fredroy ... could you explain the why of the caching system ? To me the general design of high performance rendering should be to draw batch of frames to the gl subsystem to minimize gl state change. The two way I could see for doing such a thing are:
|
1- drawFrame() has a annoying size parameter which is not applied linearly on all the frame (different scale between the tip and the body of the arrows) So this map (which was already here before) was/is to store the already created vertices/triangles. |
When trying this dummy example I had a segfault when selecting the mstate to be drawn.
This is beacause the key type mismatched the object real type and thus, finding in map wasn't working correctly so the second call to
at, even though the map was filled right before, endend in a segfault.By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if