Results 1 to 9 of 9

Thread: Seleciting - Picking vertices - shoot-through

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2001
    Posts
    26

    Seleciting - Picking vertices - shoot-through

    Hi,

    I'm writing a modeling package and I implemented a mechanism to select vertices or a group of vertices.

    Everything works fine, but the annoying thing is that the selection always seems to 'shoot-through' my meshes.

    Is there a way I can select only 'visible' vertices ?

    Uther
    U.P

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2001
    Posts
    26

    Re: Seleciting - Picking vertices - shoot-through

    Made temp solution by getting the bounding box and calculating the average depth.

    It's not the perfect solution, but it allows me to continue though.

    Still hoping that someone can provide me with a better solution

    Uther
    U.P

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Birmingham, UK
    Posts
    3

    Re: Seleciting - Picking vertices - shoot-through

    Hi there,
    I you mean it's picking verticies from the other side of the mesh, use the normals of the verticies to see if the vertex is pointing towards or away from the screen. This is assuming you have normals for your verticies....
    - Brian

  4. #4
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Seleciting - Picking vertices - shoot-through

    a posible method is once u have the vertices. draw them again with say glDepthFunc( GL_EQUAL) if they get drawn ie they pass the depth test , then they can be seen else there is geometry obscutring them so they fail the depth test.

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2001
    Posts
    26

    Re: Seleciting - Picking vertices - shoot-through

    I tested the trick with the depth buffer (see code below), but it doesn's seem to work.

    Am I doing something wrong here ?
    ...or does the depth test has no effect on the name stack ?

    ////////////////////////////////////////
    void draw3d_select(void)
    {
    glPushAttrib(GL_DEPTH_BUFFER_BIT);
    glClear( GL_DEPTH_BUFFER_BIT );

    int i = 0;
    glBegin( GL_POINTS );
    for (i=0; i < ss->nrPoints; ++i )
    {
    glVertex3f( (float) data[ i ]->x,
    (float) data[ i ]->y,
    (float) data[ i ]->z );
    }
    glEnd();

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);

    for (i=0; i < ss->nrPoints; ++i )
    {
    glPushName(i);
    glBegin( GL_POINTS );

    glVertex3f( (float) data[ i ]->x,
    (float) data[ i ]->y,
    (float) data[ i ]->z );


    glEnd();
    glPopName();
    }

    glPopAttrib();
    }
    ////////////////////////////////////////
    U.P

  6. #6
    Junior Member Newbie
    Join Date
    Mar 2001
    Posts
    26

    Re: Seleciting - Picking vertices - shoot-through

    Problem still not solved

    Any ideas ?
    U.P

  7. #7
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Seleciting - Picking vertices - shoot-through

    well for all the selected vertices.
    run a line segment from each vertice to the camera + check if this linesegment intersects any polygons in the scene if so then the vertice cant be seen from the camera.

  8. #8
    Junior Member Newbie
    Join Date
    Mar 2001
    Posts
    26

    Re: Seleciting - Picking vertices - shoot-through

    Thanx... I'll solve it this way...

    Still I think there should be some kind of link between the depth buffer and the pushing of names.
    Maybe something for the next OpenGl version
    U.P

  9. #9
    Senior Member Regular Contributor
    Join Date
    Aug 2000
    Posts
    174

    Re: Seleciting - Picking vertices - shoot-through

    Hmmm

    Hello guys ...

    I was searching about selection, and I found this, will it not be possible to control witch is the correct vertex working with the Z value from the hit ?

    Just an idea, if not, can some one correct me , why we can't use this ?

    Tnks
    Best regards
    Kurt

Similar Threads

  1. Basic Shoot Game but I could not manage to encoding
    By bequietmimix in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-20-2018, 02:21 AM
  2. Ray Picking vertices
    By samurle in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 05-17-2017, 02:31 PM
  3. Replies: 1
    Last Post: 12-08-2003, 05:04 PM
  4. I can shoot only one bullet not 2 !
    By Leyder Dylan in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-20-2003, 03:40 PM
  5. Code Warrior and Win ME (Oh please, shoot me!)
    By kellody in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-28-2001, 04:59 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