|
-
October 13th, 2003, 05:01 AM
#1
A strange program
hello guys:
When I do my program, I found a very strange code. Hopefully, you can help me to find out what's wrong with it.The codes are as follows:
GLdouble *SWinCoorX;
GLdouble *SWinCoorY;
GLdouble *SWinCoorZ;
//In the constructor, I declared these:
SWinCoorX = new double [10000];
SWinCoorY = new double [10000];
SWinCoorZ = new double [10000];
// In the distructor, I declared these:
delete [] SWinCoorX;
delete [] SWinCoorY;
delete [] SWinCoorZ;
//In the ...View.cpp, I wrote the codes as :
void CAMUNURBSView::OnLButtonDown(UINT nFlags, CPoint point)
{
int i;
double TempWinCoorX[10000],TempWinCoorY[10000],TempWinCoorZ[10000];
....
....
for(i = 0;i < pDoc->S3DSModel->p3DS_Object[0]->a_NumVts;i++)
{
SObjectCoorX[i] = pDoc->S3DSModel->p3DS_Object[0]->a_dVt[i].x;
SObjectCoorY[i] = pDoc->S3DSModel->p3DS_Object[0]->a_dVt[i].y;
SObjectCoorZ[i] = pDoc->S3DSModel->p3DS_Object[0]->a_dVt[i].z;
::glGetDoublev(GL_MODELVIEW_MATRIX, SmodelMatrix);
::glGetDoublev(GL_PROJECTION_MATRIX, SprojMatrix);
::glGetIntegerv(GL_VIEWPORT, SpVport->Port);
gluProject(SObjectCoorX[i], SObjectCoorY[i], SObjectCoorZ[i], SmodelMatrix, SprojMatrix, SpVport->Port,
SWinCoorX, SWinCoorY, SWinCoorZ);
TempWinCoorX[i] = SWinCoorX[i];
TempWinCoorY[i] = SWinCoorY[i];
TempWinCoorZ[i] = SWinCoorZ[i];
....}
....
}
Now you can see, in the function "gluProject()", the last three parameters are "SWinCoorX,SWinCoorY, SWinCoorZ". I defined them as pointers. However, when I used debug to check their values, I found that their addresses are not changed, and the values wich they point to are changed. So can you find what is the problem? I really confuse now. Thank you very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|