How to realize the function of glPushName and glPopName
How can I realize the functiong of glPopName and gl开发者_如何学GoPopName in openGL 3.x ?
OpenGL-3 no longer has SELECTION mode. Practically no OpenGL implementation out there did selection mode with hardware acceleration. One always dropped into software emulation mode.
Instead you could implement one of those:
Rendering each object with a different colour, used as an index. Then read back the area of interest, and after that re-render the scene as usual. This is as close to selection mode as it gets.
Read back the depth buffer values in the area of interest, project back into world positions and determine from your scene data, which object is at the selected position.
Or completely without OpenGL:
- Implement a ray-scene intersection test. Use spatial subdivision structures like Octree or Kd trees for acceleration.
精彩评论