OpenGL Object Section gluUnProject

I use gluUnProject to lay the beam on the scene and add the primitive there. What I'm trying to do is now select exactly the existing primitives, so if I have 3 spheres, I could click on one to delete it.

I think the decision will somehow check if the ray intersects the object and checks if it is closest to the beginning of the cast. My solution is still primitive and surrounds all objects with a bounding cube, anyway it's easy to do it exactly for spheres, using:

does the ray intersect with ( object)

or

returnRayIntersections(ray);

The last thing I use OpenGL with GLUT.

Thanks to everyone, Laurence

+3
source share
2 answers

OpenGL :

, , . 24- , # 000001, # 000002 .. , .., , , , .

( glSwapBuffers). glReadPixels back-buffer GL . , , . , , ( # 000001, # 000002 ..).

. , , GL_SELECTION. 3D- , , , , . GL , . , 3D-, , , .

+1

OpenGL - , , . , : GL :

glRenderMode (GL_SELECT);

, , . .

Nehe , .

+3

Source: https://habr.com/ru/post/1726950/


All Articles