Helen
01-15-2002, 06:02 PM
I want to draw some points or polygons to form objects,then I can pick the objects.
The question is that if I put this program above into OnLButtonDown(),there is not anything happened.if I can't get viewport[] and glRenderMode(GL_RENDER) is always return 0, I can't pick any objects.
However, when I call PickPoint() in OnDraw(), I can correctly get viewport[] and glRenderMode(GL_RENDER).But, after I pick correctly 30 times/objects, I have to press two Left-Button to get a object with screen flare.
Thanks very much!!!
void CWGSView::myDrawScene(GLenum mode)
{
int i;
glClearColor(0.5f,0.7f,0.5f,1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(0.0f,0.0f,-30.0f);
glPointSize(2);
glColor3f(1,0,0);
for(i=0; i<=8; i++)
{
if (mode==GL_SELECT)
glLoadName (i);
glBegin(GL_POINTS);
glVertex3f(i,i,0);
glEnd();
}
}
The question is that if I put this program above into OnLButtonDown(),there is not anything happened.if I can't get viewport[] and glRenderMode(GL_RENDER) is always return 0, I can't pick any objects.
However, when I call PickPoint() in OnDraw(), I can correctly get viewport[] and glRenderMode(GL_RENDER).But, after I pick correctly 30 times/objects, I have to press two Left-Button to get a object with screen flare.
Thanks very much!!!
void CWGSView::myDrawScene(GLenum mode)
{
int i;
glClearColor(0.5f,0.7f,0.5f,1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(0.0f,0.0f,-30.0f);
glPointSize(2);
glColor3f(1,0,0);
for(i=0; i<=8; i++)
{
if (mode==GL_SELECT)
glLoadName (i);
glBegin(GL_POINTS);
glVertex3f(i,i,0);
glEnd();
}
}