segmentation fault in btMotionState
Posted: Tue Feb 17, 2015 2:36 pm
Hello everyone, I have been getting segmentation fault errors in my code in the line where btMotionState is used. The purpose of the function is to render a plane. The function where the error is shown is given below:
The code above was working fine when I used OpenGL with bullet physics. Then I needed to use assimp library to load models, so I needed to change the code, which later resulted in a segmentation fault. I commented out the part where motion state is used and any other parts relating it. Then, no errors were shown. What could be the possible cause of error? I read somewhere that if there are other libraries also using bullet physics, but of a different version, then errors are thrown at random places.
Code: Select all
void rag::renderPlane(btRigidBody* plane, matrices& pipeline, unsigned int program)
{
if(plane->getCollisionShape()->getShapeType()!=STATIC_PLANE_PROXYTYPE)
return;
glColor3f(0.8,0.8,0.8);
btTransform t;
btMotionState* motionState=plane->getMotionState(); //error here
plane->getMotionState()->getWorldTransform(t);
float mat[16];
t.getOpenGLMatrix(mat);
glm::mat4 phys = returnMatrixFromMembers(mat);
pipeline.pushMatrix();
pipeline.updateMatrices(program);
glBegin(GL_QUADS);
glVertex3f(-1000,0,1000);
glVertex3f(-1000,0,-1000);
glVertex3f(1000,0,-1000);
glVertex3f(1000,0,1000);
glEnd();
pipeline.popMatrix();
}