怎么用glMultMatrixd(...)实现glTranslated(...)的功能??

tseny 2005-04-26 12:32:38
// why this following function can't replace glTranslated(...)
// I thought it's easy to implement, but it seems I was wrong!
// Give me a hand, thank you!

void myTranslate(double tx, double ty, double tz)
{
double Mt[4][4];

Mt[0][0] = 1;
Mt[0][1] = 0;
Mt[0][2] = 0;
Mt[0][3] = tx;

Mt[1][0] = 0;
Mt[1][1] = 1;
Mt[1][2] = 0;
Mt[1][3] = ty;

Mt[2][0] = 0;
Mt[2][1] = 0;
Mt[2][2] = 1;
Mt[2][3] = tz;

Mt[3][0] = 0;
Mt[3][1] = 0;
Mt[3][2] = 0;
Mt[3][3] = 1;

glMultMatrixd(&Mt[0][0]);
}
...全文
377 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Diab1o 2005-04-26
  • 打赏
  • 举报
回复
void glMultMatrixd(
const GLdouble *m
);
The m parameter points to a 4x4 matrix of single- or double-precision floating-point values stored in column-major order.
That is to say you should transpose Mt before glMultiMatrixd.

8,304

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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