唉,做论文遇到很多问题,真不知道从何问起了。要是有个算法就好了。哪位大侠帮帮忙。
解决方案 »
- >>>??? 2D游戏中如果用GDI来贴图的话,是不是很落后?
- 新手问个窗口动态改变大小问题
- 为什么我的SetWindowsHookEx总是返回NULL
- 求教平面点坐标变换的算法,拜托给位了
- 小问题:void func(char *p)中想修改p的值,比如指向"abc",怎么做?
- 100分求助:如何手工安装activex到IE中去,大虾帮忙啊
- 郁闷!为什么我们VC版没有VB版中的“控件”版?
- 最近写了个短信收发程序(GB—PDU、PDU—GB、UNICODE转换的动态连接库)
- 一个VC DEBUG版程序在运行1到2天后无故消失(没有任何错误信息),是由什么原因导致的?
- 求助,怎样在javascript中调用c++函数?
- 怎么样枚举系统中所有进程的窗体?包括托盘里面的程序!
- 今天向mm表白被拒了,郁闷,散分!
我根据每个点的重要度(到平均平面的距离)与自由度(包含此点的边的个数)来简化模型。
不同参数的重要度与自由度简化出不同复杂程度的简化模型,我一共简化出五个。但是要做到动态的LOD细节层次。初步的想法应该是离视点近的地方采用较细致的模型,远的地方用比较粗的。通过与视点的距离来控制三角形的显示。但是后面的与OPENGL的联系比较紧,我对OPENGL不是很熟,一筹莫展。
http://alphasun.port5.com/alphasun/index.htm
我正在做OpenGL三维交互,要算出鼠标点中的一个物体的三维坐标。我现在手上的例子只有和平鸽工作室编的两个简单程序:选择与反馈。我应该去哪里找资料?
Tieren_love(甜蜜程序员) :给你一个连接
http://community.csdn.net/Expert/topic/3146/3146805.xml?temp=.1424677
void CMeshView::OnMouseMove(UINT nFlags, CPoint point)
{
GLfloat fdepth;
GLdouble ObjectX, ObjectY, ObjectZ;
GLint iViewPort[4];
GLdouble dProjMatrix[16];
GLdouble dModelMatrix[16];
POINT iScreen;
int iScrToWinX, iScrToWinY;
long iError;
SpaceDot pp; CClientDC ClientDC(this);
wglMakeCurrent(ClientDC.m_hDC, m_hGLContext); //使 RC 与当前 DC 相关联
glGetIntegerv(GL_VIEWPORT, iViewPort);
glPushMatrix();
glGetDoublev(GL_MODELVIEW_MATRIX, dModelMatrix);
glGetDoublev(GL_PROJECTION_MATRIX, dProjMatrix);
::GetCursorPos(&iScreen);
iScrToWinX = iScreen.x-point.x;
iScrToWinY = iScreen.y-point.y;
glReadPixels(point.x, iViewPort[3]-point.y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &fdepth);
gluUnProject((GLdouble)point.x,
(GLdouble)(iViewPort[3]-point.y),
(GLdouble)fdepth,
dModelMatrix,
dProjMatrix,
iViewPort,
&ObjectX,
&ObjectY,
&ObjectZ); {
pp.x = (float)ObjectX;
pp.y = (float)ObjectY;
pp.h = (float)ObjectZ;
}
glPopMatrix();
iError = glGetError();
if(iError!=GL_NO_ERROR)
{
::MessageBox(NULL, (LPCTSTR)gluErrorString(iError), "提示13:", MB_OK);
}
wglMakeCurrent(ClientDC.m_hDC, NULL);//释放 RC,以便其它 DC 进行绘图 CString str;
CMainFrame *pFrame = (CMainFrame *)AfxGetApp()->m_pMainWnd;
CStatusBar *pStatus = &pFrame->m_wndStatusBar;
int nIndex;
if(pStatus)
{
str.Format("X=%f",pp.x);
nIndex = pStatus->CommandToIndex(ID_MODEL_X);
pStatus->SetPaneText(nIndex,str,TRUE);
}
CView::OnMouseMove(nFlags, point);
}
之后,在这里出错了:纹理绑定 // 纹理
//***********************************
unsigned int NbTexture = m_ArrayTexture.GetSize();
if(NbTexture)
{
TRACE("SceneGraph : texture binding...(%d texture(s))\n",NbTexture); // 清除
if(m_pIndexTextureBinding != NULL)
{
::glDeleteTextures(NbTexture,m_pIndexTextureBinding);
delete [] m_pIndexTextureBinding;
m_pIndexTextureBinding = NULL;
} if(m_bTexture)
{
m_pIndexTextureBinding = new unsigned int[NbTexture];
::glGenTextures(NbTexture,m_pIndexTextureBinding);
int error = glGetError();
ASSERT(error != GL_INVALID_VALUE); //error!!!!!
ASSERT(error != GL_INVALID_OPERATION); TRACE("Bind texture...\n");
........
}
} error == GL_INVALID_OPERATION
//***********************************
CClientDC ClientDC(this);
wglMakeCurrent(ClientDC.m_hDC, m_hGLContext); //使 RC 与当前 DC 相关联
unsigned int NbTexture = m_ArrayTexture.GetSize();
if(NbTexture)
{
TRACE("SceneGraph : texture binding...(%ld texture(s))\n",NbTexture); // 清除
if(m_pIndexTextureBinding != NULL)
{
::glDeleteTextures(NbTexture,m_pIndexTextureBinding);
delete [] m_pIndexTextureBinding;
m_pIndexTextureBinding = NULL;
} if(m_bTexture)
{
m_pIndexTextureBinding = new unsigned int[NbTexture];
::glGenTextures(NbTexture,m_pIndexTextureBinding);
int error = glGetError();
ASSERT(error != GL_INVALID_VALUE); //error!!!!!
ASSERT(error != GL_INVALID_OPERATION); TRACE("Bind texture...\n");
........
}
} wglMakeCurrent(ClientDC.m_hDC, NULL); //使 RC 与当前 DC 相关联
确实是这样的。没有关联DC。