Hi Everyone,

I am working on a 3D display program for windows. I need to use feedback mode in opengl to get the screen coordinates for each (x, y,z) point displayed on the screen. The information came back from the feedback buffer has problem -- the screen coordinates for the first point is used for all the points in the feedback buffer. Any suggestions? Thank you so much in advance. tobby. The following are the codes.

-------------------------------------------------------------
buffsize = MAXNPTS*3;
feedBackBuff = (GLfloat *)calloc(buffsize, sizeof(GLfloat));

glFeedbackBuffer(buffsize, GL_2D, feedBackBuff);

glRenderMode(GL_FEEDBACK);

// Redraw the scene
Draw_Raw_Pts_Edit(npts_gd, x_gd, y_gd, z_gd, r_gd);

size = glRenderMode(GL_RENDER);

i = 0;
while(i < buffsize)
{
if(feedBackBuff[i] == GL_POINT_TOKEN)
{
xt=feedBackBuff[i+1]; yt=feedBackBuff[i+2];
st=point_inside_polygon(xt, yt, npts_s, Select_X, Select_Y);
if (st == 1 && r_gd[i/3] == 1) r_gd[i/3] = mode;
}
i += 3;
}
free(feedBackBuff);

----------------------------------------------------------------

Draw_Raw_Pts_Edit() are as follow:

glPushMatrix();

glTranslatef(xShift, yShift, 0.0f);
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 0.0f, 1.0f);


glPointSize(5);
glBegin(GL_POINTS);
glColor3ub(0, 255, 0);
glVertex3f(x1, y1, z1);
glVertex3f(x2, y2, z2);
....

glEnd();
glPointSize(1);

glPopMatrix();