Results 1 to 2 of 2

Thread: pick some points

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2001

    pick some points

    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;



    for(i=0; i<=8; i++)
    if (mode==GL_SELECT)
    glLoadName (i);


  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000

    Re: pick some points

    Seems like you context is not current when you receive mouse click events and it's because MFC mouse click handling is in a different thread than the one doing the drawing.

    The only way you can solve your problem is when your receive a LButtonDown event, set a flag to says you want to pick, and when OnDraw gets called next time, you will pick the object from the function.( the OnDraw function is called from the thread having the context current).

    The other solution would be to make the context not current in the drawing thread when it switches and make it current in your thread, but since you don't when thread switch occurs, this solution is impossible.

    Well, you can also implement your own picking function from the data you have if it is possible. In this case you would not need to do any opengl call and the function would work from LButtonDown.

Similar Threads

  1. Replies: 3
    Last Post: 10-30-2013, 02:58 PM
  2. Pick Selection Editing by Points and Lines
    By Nick_Miller in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-24-2012, 11:32 AM
  3. Replies: 3
    Last Post: 01-01-2002, 01:23 PM
  4. knot points and control points in NURBS
    By kkher in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 12-19-2000, 07:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean