Thanks for the replies guys. I found a super easy way to do it though. There is a function set called ZPR (Zoom Pan Rotate - http://www.nigels.com/glt/gltzpr/)..)
-
it is great for what I am doing (plotting stuff that i want to look at, nothing like gaming haha)
-
all you have to do to select an object in a display list is:
int main()
{
//...other setup stuff...
zprSelectionFunc(SelecFunc);
zprPickFunc(pick);
//...more stuff...
}
void pick(GLint name)
{
printf("Pick: %d
", name);
fflush(stdout);
}
void SelecFunc()
{
DrawSpheres();
glCallList(TestList);
}
This should be global
GLuint TestList;
void DrawSpheres()
{
TestList = glGenLists(1);
glNewList(TestList,GL_COMPILE);
DrawSphere(0,0,0,1,0,0,5);
DrawSphere(1,0,0,0,1,0,6);
DrawSphere(0,1,0,0,0,1,7);
glEndList();
}
void DrawSphere(double x, double y, double z, double r, double g, double b, GLuint nam)
{
glPushMatrix();
glPushName(nam);
glColor3f(r,g,b);
glTranslatef(x,y,z);
glutSolidSphere(1, 20, 20);
glPopName();
glPopMatrix();
}
Hope this helps others! By the way, why is something to the effect of ZPR not built right into glut?? It seems to be SUPER useful!
-Dave