游戏开发论坛

 找回密码
 立即注册
搜索
查看: 6951|回复: 2

???OPENGL????????????????????

[复制链接]

1

主题

6

帖子

6

积分

新手上路

Rank: 1

积分
6
发表于 2007-6-3 17:00:00 | 显示全部楼层 |阅读模式
????????http://www.5inet.net/Develop/DevCraft/052742.html

?????????????????3??(-300.00, 300.00, 0.00),(300.00, -300.00, 0.00),(-300.00, -300.00 0.00)

??gluUnProject((GLdouble)point.x, (GLdouble)realy, 0.0, mvmatrix, projmatrix, viewport, &wx, &wy, &wz)???????????????????????????????????????????????1.0????????????????????????????????????????????

????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????????????????

5

主题

972

帖子

975

积分

高级会员

Rank: 4

积分
975
发表于 2008-11-28 14:48:00 | 显示全部楼层

Re:???OPENGL???????????????????

????????????lz????????????

ps???????????

1

主题

24

帖子

31

积分

注册会员

Rank: 2

积分
31
发表于 2009-8-31 21:04:00 | 显示全部楼层

Re:???OPENGL???????????????????

?????OpenGL????
????OpenGL???????????????OpenGL???????????????????
GLint viewport[4];
GLdouble modelview[16];
GLdouble projection[16];
GLfloat winX, winY, winZ;
GLdouble posX, posY, posZ;
glGetIntegerv(GL_VIEWPORT, viewport);
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
glGetDoublev(GL_PROJECTION_MATRIX, projection);
winX = (float)x; winY = viewport[3] - (float)y;
glReadPixels((int)winX, (int)winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);
gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
??(x, y)??????(winX, winY, winZ)????????????(posX, posY, posZ)?OpenGL???
    ???????????????????????glViewport(0, 0, screenWidth, screenHeight)?screenWidth?screenHeight??????????????????????0?0??????????????
    ??????OpenGL???????????????????????????????????OpenGL??????????winX = (float)x; winY = viewport[3] - (float)y;??????gluUnProject??????????gluUnProject??????????? ???????????????glGetIntegerv???????????????????????????????????????????????????????????????????????????????????????????????????????????glGetIntegerv??????????????
  ?winx = x ? viewport[0]; winy = screenHeight ? viewport[1] - y; viewport[0] = viewport[1] = 0;
  ?winx = x; winy = screenHeight ? y;
    ?????????????????????????????????????????????0?0???????????????glViewport????????????????0?0??????????????????????????????????????????
    ??????????????????????glUnproject???winx?winy???????? ????????????????
GLint viewport[4];
GLdouble modelview[16];
GLdouble projection[16];
GLfloat winX, winY, winZ;
GLdouble posX, posY, posZ;
glPushMatrix(); // ?????????????????????????
glScalef(m_srtMatrix[0], m_srtMatrix[1], m_srtMatrix[2]); // ??????????
glRotatef(m_srtMatrix[3], 1.0f, 0.0f, 0.0f);
glRotatef(m_srtMatrix[4], 0.0f, 1.0f, 0.0f);
glRotatef(m_srtMatrix[5], 0.0f, 0.0f, 1.0f);
glTranslatef(m_srtMatrix[6], m_srtMatrix[7], m_srtMatrix[8]);
glGetIntegerv(GL_VIEWPORT, viewport); // ???????????????
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glPopMatrix();
winX = x; winY = screenHeight - y;
glReadPixels((int)winX, (int)winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);
gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-8-6 22:56

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表