I have imported a model (e.g. a teapot) using Rajawali into my scene. What I would like is to label parts of the model (e.g. the lid, body, foot, handle and the spout) using plain Android views, but I have no idea how this could be achieved. Specifically, positioning the labels on the right place seems challenging. The idea is that when I transform my model's position in the scene, the tips of the labels are still correctly positioned
Rajawali tutorial show how Android views can be placed on top of the scene here https://github.com/Rajawali/Rajawali/wiki/Tutorial-08-Adding-User-Interface-Elements . I also understand how using the transformation matrices a 3D coordinate on the model can be transformed into a 2D coordinate on the screen, but I have no idea how to determine the exact 3D coordinates on the model itself. The model is exported to OBJ format using Blender, so I assume there is some clever way of determining the coordinates in Blender and exporting them to a separate file or include them somehow in the OBJ file (but not render those points, only include them as metadata), but I have no idea how I could do that.
Any ideas are very appreciated! :)
I would use a screenquad, not a view. This is a general GL solution, and will also work with iOS.
You must determine the indices of the desired model vertices. Using the text rendering algo below, you can just fiddle them until you hit the right ones.
The performance bottleneck is #7 since the entire bitmap must be copied to GL texture memory, every frame. Try to keep the bitmap as small as possible, maintaining aspect ratio. Maybe let the user toggle the labels.
Note that the copy to GL texture memory is redundant since in OpenGL-ES, GL memory is just regular memory. For compatibility reasons, a redundant chunk of regular memory is reserved to artificially enforce the copy.