I’m creating a modelling tool and need an easy way of selecting objects in my scene. Any input is welcomed. I’ve basically got two strategies.
a ) Using the selection buffer. This is tiresome as I need to name every triangle in my mesh ( I need to be able to select individual triangles ). From reading the red book I can’t put the glLoadName() between a glBegin(GL_TRIANGLES) and a glEnd() correct ? This leaves me two options:
1 ) name each mesh as a whole and allow selection on the mesh basis ( not enough detail in my selection ) .
2 ) use glLoadName(i) followed by a loop through all my triangles in the mesh and use glBegin(GL_TRIANGLE) instead.
I’m not liking either of these options. Particularly as I have 4 viewports in my window and in order to do the selection I need to figure out which one was clicked and construct my viewing matrix from that, converting mouse coordinates as I go. I’ve also had problems with this method as I’m using double-buffering with MFC and the rendering context needs to be current. Anyone seen this before ?
Second strategy is to use the drawing to the back buffer method and check the color under the mouse coordinates. This seems simpler and more efficient plus would give me the detail I need but I can’t get it to work.
Does anyone have an example of this on their site ? I’ve tried searching but to no avail. Again any help is appreciated.
Rock on !!!