Question

I'm currently dealing with OpenGL ES (2, iOS 6)… and I have a question

i. Let be a mesh that has to be drawn. Moreover,

ii. I can ask for a rotation/translation so that the point of view changes.

So, how can I know (in real time) the position of any vertex that is displayed?

Thank you in advance.

jgapc

Was it helpful?

Solution

It's not entirely clear what it is you are after, but if you want to know where your object is after doing a bunch of rotations and translations, then one very easy option, if you perform these changes in your program code instead of in the shader, is to simply take the entire last row or column of your transformation matrix (depends if you are using row or column major matrices) which will be the final translation of your object's center as a coordinate vector.

This last row or column is the same thing as multiplying your final transformation matrix by your object's local coordinate center vector, which is (0,0,0,1).

If you want to know where an object's vertex is, rather than the object's center, then multiply that vertex in local coordinate space by the final transformation matrix, and you will get the new coordinate where that vertex is positioned.

OTHER TIPS

There are two things I'd like to point out:

  1. Back-face culling discards triangles, not vertices.
  2. Triangles are also clipped so that they're within the viewing frustum.

I'm curious as to why you care about what is not displayed?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top