I continued work on the stored selection feature and also a bit on the selection in the OpenGL renderer. Neither have progressed very far, as I am still struggling with the details of how to implement them.
Additionally I have looked into another issue which has been open for some time. The OpenGL renderer has problems with transparent objects. I looked into ways to solve it for some time, but still don't know how to do it. The standard advise for OpenGL is, to "just render back to front", but quite honestly that advise is completely useless.
It is correct, that then alpha blending results in the correct image, but it is also nearly impossible to implement. I would have to collect each transparent face in the whole model, sort them according to depth and then render them. Apart from the trouble to even store all the information needed to render a face, the number of state changes would probably bring OpenGL to a crawling.
The problem is, that in contrast to a game I have a lot of transparent faces. When I work on an object, I switch it to transparent so I can also see the backside of the object. Also when I have a mold I often switch that also to a transparent color to see through the mold. So I often have transparent objects and I often have multiple layers of them. So the sorting of faces is out of the question.
What I could do is to sort the objects (and not the faces) by their depth and render them back to front. I have a plan on what else to do, but I am still unsure if it will work. The idea is to render objects twice and use some tricks with the depth buffer. The depth buffer at the start of the transparent pass contains the values from the opaque faces. When I render a transparent face, I first render only the parts which are farther from the viewer than the nearest object. The draw buffer (what is displayed) records besides the colors also the alpha values. I would set the blending mode so, that that value is used to combine the new color with the already existing ones. So if the color at that position is opaque nothing will be rendered.
Then I would render again, this time only the parts which are in front of the parts which were already rendered and would use the source alpha. Also I would store the current depth in the depth buffer and set the source alpha into the draw buffer.
That way the nearest object to the camera would be handled correctly, the color behind it could be quite wrong. But by depth sorting the objects it should be right as long as the objects aren't intersecting or one object is surrounding another one. But even in those cases the result shouldn't be totally wrong and I hope at least better than what I currently have.