[Development] strange behavior with plugin

Alessio Mochi alessio211734 at yahoo.it
Tue Apr 21 14:57:07 CEST 2015


Hello,

I tried to add some code for opengl vbo creation inside my qt plugin. 
I initialize vbo buffer inside the plugin and after it my program crash in rendering vbo method on one glBindBuffer call.

this function is called when plugin start and after it my application crash on a rendering method while 
render the tooth node just created.
bool testPlugin::StartEdit(RenderNode & r, GLArea *gla ) 
{ 
   connect(this,SIGNAL(createVbo()),gla,SLOT(updateVbo())); 
   RenderNode * meshNode=new Tooth("test",&r); 
   MeshModel * model=new MeshModel("test.ply"); 
   int result=vcg::tri::io::ImporterPLY<CMeshO>::Open(model->cm, "d:/debugMesh/save.ply", NULL); 
   vcg::tri::UpdateNormal<CMeshO>::PerVertexPerFace(model->cm); 
   meshNode->toMeshNode()->setMeshModel(model); 
   r.appendChild(meshNode);
   emit createVbo();
}


createVbo is a signal connected to updateVbo() 
GLArea slot. GLArea is a derivate of GLWidget class.

I don't know why but if I create an external slot inside GLArea with the code contains in 
testPlugin::StartEdit function my program run correctly while if I let all the code inside the 
testPlugin::StartEdit the rendering function called in GLArea crash.
My render code is in my application (.exe) and is in a method of GLArea.


I noticed a strange behavior with debugger looking the stack call function. When the Tooth and MeshModel object is instanced inside my plugin class the method draw in GLArea call the draw method relative to Tooth object and referring to plugin code.

while when Tooth and MeshModel object is instanced outside my plugin class the draw method for the Tooth object is relative to application code (.exe). When the tooth draw code is referred to plugin my application crash.
Tooth is subclass of MeshNode.

This is the stack call of render function when plugin code is outside from it and it's connected
to plugin signal. Inside the plugin there is only a emit that call external vbo initialization code.

DentalCad.exe!MeshModel::Render(vcg::GLW::DrawMode _dm=DMSmooth, vcg::GLW::ColorMode _cm=CMPerMesh, vcg::GLW::TextureMode _tm=TMNone)  Line 111	C++ 
DentalCad.exe!MeshNode::draw(const RenderMode & rmode={...})  Line 125 + 0x39 bytes	C++ 
DentalCad.exe!GLArea::renderSceneGraph(RenderNode * root=0x0519b330, bool filterTooths=false, const vcg::Color4<unsigned char> & colorPerMesh={...})  Line 591	C++ 
DentalCad.exe!GLArea::paintEvent(QPaintEvent * event=0x0035cb4c)  Line 400	C++ 



and this is the stack call when all the code is inside the plugin (in this case application crash!)
testPlugin.dll!vcg::GlTrimesh<CMeshO,0,std::vector<CFaceO *,std::allocator<CFaceO *> > >::DrawFill<1,1,0>()  Line 477	C++ 
testPlugin.dll!vcg::GlTrimesh<CMeshO,0,std::vector<CFaceO *,std::allocator<CFaceO *> > >::Draw<6,1,0>()  Line 433	C++ 
testPlugin.dll!vcg::GlTrimesh<CMeshO,0,std::vector<CFaceO *,std::allocator<CFaceO *> > >::Draw<6,1>(vcg::GLW::TextureMode tm=TMNone)  Line 394 + 0x8 bytes	C++ 
testPlugin.dll!vcg::GlTrimesh<CMeshO,0,std::vector<CFaceO *,std::allocator<CFaceO *> > >::Draw<6>(vcg::GLW::ColorMode cm=CMPerMesh, vcg::GLW::TextureMode tm=TMNone)  Line 382 + 0xc bytes	C++ 
testPlugin.dll!vcg::GlTrimesh<CMeshO,0,std::vector<CFaceO *,std::allocator<CFaceO *> > >::Draw(vcg::GLW::DrawMode dm=DMSmooth, vcg::GLW::ColorMode cm=CMPerMesh, vcg::GLW::TextureMode tm=TMNone)  Line 370 + 0x10 bytes	C++ 
testPlugin.dll!MeshModel::Render(vcg::GLW::DrawMode _dm=DMSmooth, vcg::GLW::ColorMode _cm=CMPerMesh, vcg::GLW::TextureMode _tm=TMNone)  Line 115	C++ 
testPlugin.dll!MeshNode::draw(const RenderMode & rmode={...})  Line 125 + 0x39 bytes	C++ 
DentalCad.exe!GLArea::renderSceneGraph(RenderNode * root=0x05019768, bool filterTooths=false, const vcg::Color4<unsigned char> & colorPerMesh={...})  Line 591	C++ 
DentalCad.exe!GLArea::paintEvent(QPaintEvent * event=0x0041ca14)  Line 400	C++ 



Thanks in advance.

Ale.



More information about the Development mailing list