OpenGL三维模型显示问题

niuhao0124 2014-06-17 10:45:38
我现在在做姿态测量的实验,需要利用三维模型显示姿态测量的结果。如图是我显示的结果,姿态差不多是正确的,但是模型有一部分没有显示出来,看起来像是被截断,希望请各位大神看看原因,以下是我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();
}
...全文
554 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qiminixi 2014-06-17
  • 打赏
  • 举报
回复
飞机插到什么东西里吧??
赵4老师 2014-06-17
  • 打赏
  • 举报
回复
检查面的法向量方向 使用双面材质 …… 先试试以线框模型渲染

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧