opengl es - How can I calculate uv coordinates for vertices if I know the vertex coordinate of my texture on a plane -
i'm trying map texture on plane, know vertex coordinates texture, , coordinates 4 vertices. how can calculate uv texture coordinates 4 vertices?
here's picture show i'm trying do,
the yellow grid area texture, square texture skewed shape. green area plane want map texture on to. know vertex coordinates point a
, b
, c
, d
, , point 1
, 2
, 3
, 4
.
for example, if texture placed this
those vertex coordinates points. uv coordinates point a
, b
, c
, d
should (-0.5f, -0.5f), (1.5f, -0.5f), (1.5f, 1.5f), (-0.5f, 1.5f)
but if texture skewed first picture, how can calculate uv coordinates point a
, b
, c
, d
?
where trying cpu or gpu? assuming cpu project vertices of skewed plane onto green plane. if think of green plane screen has camera , therefore associated view , projection matrices project each point onto surface , find distance origin in case in middle of green plane.
from tags looks using opengl es, using fixed function or shaders? maths library use? glm has glm::project , glm::unproject want here's link info that.
here's general information on want do, want project 3d 2d , find relative distances on plane.
hope helps.
Comments
Post a Comment