专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 图形/图像

关于opengl源码的有关问题

发布时间:2011-06-27 20:41:07 文章来源:www.iduyao.cn 采编人员:星星草
关于opengl源码的问题
gluPickMatrix函数的实现在哪?我在glut源码中找了半天没有找到

------解决方案--------------------
这是vtk glu里面的代码
C/C++ code

// This function was copied from Mesa and sets up the pick matrix
inline void vtkgluPickMatrix( GLdouble x, GLdouble y,
                              GLdouble width, GLdouble height,
                              int *origin, int *size )
{
  GLfloat m[16];
  GLfloat sx, sy;
  GLfloat tx, ty;

  sx = size[0] / width;
  sy = size[1] / height;
  tx = (size[0] + 2.0 * (origin[0] - x)) / width;
  ty = (size[1] + 2.0 * (origin[1] - y)) / height;

#define M(row,col)  m[col*4+row]
   M(0,0) = sx;   M(0,1) = 0.0;  M(0,2) = 0.0;  M(0,3) = tx;
   M(1,0) = 0.0;  M(1,1) = sy;   M(1,2) = 0.0;  M(1,3) = ty;
   M(2,0) = 0.0;  M(2,1) = 0.0;  M(2,2) = 1.0;  M(2,3) = 0.0;
   M(3,0) = 0.0;  M(3,1) = 0.0;  M(3,2) = 0.0;  M(3,3) = 1.0;
#undef M

   glMultMatrixf( m );
}

#endif

------解决方案--------------------
楼主,你看看这篇文章就知道源码是怎样的了

http://blog.csdn.net/zhangci226/archive/2009/10/30/4749526.aspx
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: