I'm fairly new to OpenGL. I have 3D object and 2D image drew as HUD. At this moment, it looks like this. What I want to do now is to put 2D texture from HUD on a visible part of 3D object (in this case - front of a skull). As far as I know what I need to do is:
- check which vertices are visible (again, as far as I know and after StackOverflow searching I think this question can answer my question about how to check if vertex is visible)
- If vertex is visible transform this 3D point into 2D point (just use gluProject to get 2D coordinates)
- I know 2D coordinates of vertex, so I can compare it to pixels on texture, which brings me directly to texturing.
And here's the problem - I don't have any idea how to do action in point 3. I have of visible 3D vertices in 2D, I have 2D texture and no idea how to use this. I was thinking to use it in similar way as 2D draw, but I have much more restrictive points than in 2D quad texturing.