我现在在做姿态测量的实验,需要利用三维模型显示姿态测量的结果。如图是我显示的结果,姿态差不多是正确的,但是模型有一部分没有显示出来,看起来像是被截断,希望请各位大神看看原因,以下是我OpenGL中display的代码。
void display(void)
{
// draw the image in the back
int vPort[4]; glGetIntegerv(GL_VIEWPORT, vPort);
glEnable2D();
//drawOpenCVImageInGL(imgTex);
glTranslated(vPort[2]/2.0, 0, 0);
drawOpenCVImageInGL(imgWithDrawing);
glDisable2D();
glClear(GL_DEPTH_BUFFER_BIT); // we want to draw stuff over the image
// draw only on left part
glViewport(0, 0, vPort[2]/2, vPort[3]);
glPushMatrix();
gluLookAt(0,0,0,0,0,1,0,-1,0);
// put the object in the right position in space
Vec3d tvv(tv[0],tv[1],tv[2]);
glTranslated(tvv[0], tvv[1], tvv[2]);
// rotate it
double _d[16] = { rot[0],rot[1],rot[2],0,
rot[3],rot[4],rot[5],0,
rot[6],rot[7],rot[8],0,
0, 0, 0 ,1};
glMultMatrixd(_d);
// draw the 3D head model
glColor4f(1, 1, 1,0.75);
glmDraw(head_obj, GLM_SMOOTH);
//----------Axes
glScaled(50, 50, 50);
drawAxes();
//----------End axes
glPopMatrix();
// restore to looking at complete viewport
glViewport(0, 0, vPort[2], vPort[3]);
glutSwapBuffers();
}