Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Is using selection buffer for selection or picking slow?

  1. #1
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Is using selection buffer for selection or picking slow?

    Hi,

    I was wondering is using selection buffer slow and if so, what are the alternatives?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,258

    Re: Is using selection buffer for selection or picking slow?

    AFAIK nvidia cards switch to software mode when using these rendering modes. The fastes probably is that you do your own ray intersection test.
    - Michael Steinberg

  3. #3
    Junior Member Regular Contributor
    Join Date
    Aug 2000
    Posts
    179

    Re: Is using selection buffer for selection or picking slow?

    Hi Michael,

    The people always said that the best mode is the ray intersection, but I always asked how to do this, and they never answered, could you explain me how to do this ?

    Tnks
    Best RGDS

    Kurt

  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Re: Is using selection buffer for selection or picking slow?

    Well i think I agree with kurt, can you explain a bit?

  5. #5
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,258

    Re: Is using selection buffer for selection or picking slow?

    Let a line and a plane intersect.
    There are different attempts doing that.

    Here's one way (dunno):

    Code :
    int LinePlaneIntersect( CVector& a, CVector& b, CPlane& plane, CVector& result )
    {
    	double quot, t;
    	plane.normal.Normalize();
     
    	t    = (plane.place-a)*plane.normal;
    	quot = b*plane.normal;
     
    	if( DOUBLE_EQ( quot, 0.0 ) ) {
    		printf("\n    quotient is zero!");
    		if( DOUBLE_EQ( t, 0.0 ) ) return LPI_INSIDE;
    		else return LPI_PARALLEL;
    	}
     
    	printf( "\n    t is %f", t );
     
    	t    = t/quot;
     
    	result = a+b*t;
     
    	return LPI_CUT;
    }
    On the other hand you'd have to test wether the intersection lies on the poly. Either test wether the line lies inside the convex hull of the pyramid built from a point on the line and the polygon edges, or use a different approach.

    The plane:
    vx = va + r*vb + t*vc

    where va is a vector to a point on the plane (it's place vector), vb and vc are the span-vectors which actually build the plane.

    The line:

    vx = vd + u*ve

    Now say

    vd + u*ve = va + r*vb + t*vc

    and solve the resulting equation system.

    if r+t <= 1 and both are positive you've got an intersection inside the triangle with the egdes vb, vc and vc-vb displaced about va. Well you probably know what I mean.

    [This message has been edited by Michael Steinberg (edited 04-11-2001).]
    - Michael Steinberg

  6. #6
    Junior Member Regular Contributor
    Join Date
    Feb 2001
    Posts
    136

    Re: Is using selection buffer for selection or picking slow?

    Thnx man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •