polygon picking

Started by
0 comments, last by Pavo 22 years, 2 months ago
Hi, I know how to do object picking and stuff like that, but is there way to do the same on a single object but this time picking polygons? I just want to get information on certain polygon (coordinates of its vertices). My idea was: first pick object and then everytime between glBegin and glEnd, check if certain ray intersects current polygon plane, so if it does then i would return the values. but i dont think that''s the right way. If anyone has an example function or pseudocode idea how to do that I would appreciate it alot. Thanks in advance.
Pavo
Advertisement
If you want to retrive vertex coordinates, I''d recommend using the feedback buffer.

This method is an analog method of selection :

1- configure the feedback buffer
2- glRenderMode(GL_FEEDBACK)
3- draw your polys
4- glRenderMode(GL_RENDER)
5- decode the feedback buffer that was filled during the render

Selection buffer *only* gives you the depth information.
Feedback buffer returns the list of vertex that is used for drawing, eg transformed via modelview/projection matrices, and clipped (to the frustum, and to the clipping planes if needed).
Feedback buffer can retrieve color and texture information too.

Go to OpenGL Red Book in Chapter 13 "Selection and Feedback".
There are very good explanations there.

This topic is closed to new replies.

Advertisement