I have three points that form a triangle in a 3D scene. I want to apply an arbitrary rotation/translation transformation to this polygon and later check in which pixels of an image they would be rendered (if any), taking occlusion into account. I want to do this without having any window, so that no actual drawing is done (I know the camera parameters and the "virtual" rendering image size).
How can I accomplish this? I thought about OpenGL and the
glReadPixels function, but I am not sure that I can query for a 3D point to get its rendered 2D pixel.
For reference, I am working on a computer vision application where I have an image taken by a camera and a 3D model of a virtual object. The virtual object is a mesh of a lot of triangles. What I actually want is to project the virtual object on the image and get the positions in the image of the non-occluded triangles, so that I can manipulate the image in those positions. As I said, I don't really need to draw, just the calculations. Now, I am doing it manually and I can get rid of those points that are occluded by other points, but I do not know how to take occlusion into account when instead of single points, they are planar triangles.