Selection using lists

I have created a drawing and put it into a list. the reason I did this was so that I could rapidly display the drawing while I am zooming, panning, rotating, ect. The problem is that I need to be able to select individual parts of the drawing and give details on it. I tried to give the parts names while I was creating the drawing in the list, but I can’t select them when the drawing is rendered. Does anyone have an answer to my problem, or a better way for me to do it? Thank you very much for your help!
David

if anyone wanted to see part of my code, here it is… thank you very much again. this is only my second week with openGL as well.
btw, this is in Visual C++ MFC

void CDxfDisplayDlg: rawingCreate()
{
int pointx,pointy,pointz,i=0;
draw = glGenLists(1);
char str[30];
glNewList(draw,GL_COMPILE);
(*in).getline(str,256);
glColor3f(1.0f,1.0f,1.0f);
while(strcmp(str,“EOF”)!=0)
{
if (strcmp(str,“3DFACE”)==0)
{
glLoadName(i);
object[i].x = i;
object[i].y = i;
object[i].z = i;
(*in).getline(str,256);
(*in).getline(str,256);
(*in).getline(str,256);
(*in).getline(str,256);
pointx = atoi(str);
(*in).getline(str,256);
(*in).getline(str,256);
pointy = atoi(str);
(*in).getline(str,256);
(*in).getline(str,256);
pointz = atoi(str);
glBegin(GL_TRIANGLES);
glVertex3f(pointx,pointy,pointz);
(*in).getline(str,256);
(*in).getline(str,256);
pointx = atoi(str);
(*in).getline(str,256);
(*in).getline(str,256);
pointy = atoi(str);
(*in).getline(str,256);
(*in).getline(str,256);
pointz = atoi(str);
glVertex3f(pointx,pointy,pointz);
(*in).getline(str,256);
(*in).getline(str,256);
pointx = atoi(str);
(*in).getline(str,256);
(*in).getline(str,256);
pointy = atoi(str);
(*in).getline(str,256);
(*in).getline(str,256);
pointz = atoi(str);
glVertex3f(pointx,pointy,pointz);
glEnd();
(*in).getline(str,256);
(*in).getline(str,256);
(*in).getline(str,256);
(*in).getline(str,256);
(*in).getline(str,256);
(*in).getline(str,256);
}
(*in).getline(str,256);
i++;
}
glEndList();
char str2[30];
sprintf(str2,“Number is: %d”,i);
MessageBox(str2);
Render();
}

void CDxfDisplayDlg::OnFileOpen()
{
CString str;
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,“DXF File (.dxf)|.dxf|All Files (.)|.| |”,NULL);
int response = dlg.DoModal();
if (response == IDOK)
str = dlg.GetPathName();
in = new ifstream(str);
DrawingCreate();
}

void CDxfDisplayDlg::Selection()
{
GLuint buffer[512];
GLint hits;
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glSelectBuffer(512,buffer);
(void)glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix((GLdouble)_mouseX,(GLdouble)(viewport[3]-_mouseY),1.0f,1.0f,viewport);
gluPerspective(45.0f,(GLfloat)(viewport[2]-viewport[0])/(GLfloat)(viewport[3]-viewport[1])
,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
Render();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
hits = glRenderMode(GL_RENDER); //see if objects are under cursor
if (hits>0) //if an object was hit
{
int choose = buffer[3];
int depth = buffer[1];
for (int loop=1;loop<hits;loop++) //loop through all hit objects
{
if (buffer[loop4+1]<GLuint(depth)) //search for closest object
{
choose = buffer[loop
4+3];
depth = buffer[loop*4+1];
}
}
char mes[30]; //temp string holder
float cx = object[choose].x; //set temp holder for x point
float cy = object[choose].y; //set temp holder for y point
float cz = object[choose].z; //set temp holder for z point
//save voxel info in a string
sprintf(mes,"%.5f",%.5f",%.5f"
",cx,cy,cz);
MessageBox(mes);
}
Render(); //render the scene
}

id CDxfDisplayDlg::Render()
{
// Clear the screen.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
//moves the screen so all the images can be displayed
glTranslatef(xpos,150+ypos,-100.0f+(GLfloat)zoom);
//rotates the screen for the nice perspective view
glRotatef(xangle,1.0f,0.0f,0.0f);
glRotatef(yangle,0.0f,1.0f,0.0f);

glLoadName(1);
glCallList(draw);

// Swap buffers.
SwapBuffers(hDC->GetSafeHdc());
}

and if anyone wanted to know, I am reading the data in from a text file. It is a dxf file and I am displaying it in OpenGL, right now I only have 3dfaces included. Thanks again

can anyone help with this question?