[Help]ofMesh Texture Mapping and Image Distortion

Hi, I’m trying to make 2d textured image ofMesh. almost OK, but image distorted.
Could somebody help me which code I missed.

this is result

this is working project codes.

HI,
this is wrong

float rock_scale = rh/rw;
float image_scale = ih/iw;

There you are calculating the aspect ratio rather than the scale.

Hi Roy,

Thank you for quick reply.
I’d like to crop the image by polygon shape.

I updated codes. but still image distortion.

Hi,
can you paste your updated code?

I think the camera is distorting the mesh -see this post on how to switch it to orthogonal

Roy, Jvcleave Thank you for quick replay

I posted newest code at github.

I never thought about camera distorting, I’ll check about orthogonal.

Uhmm, Still image distorted…