Log in or register to post comments

Model rendered with misalligned texture

October 4, 2012 - 3:23pm #1

Probably a model export issue here:

 

I created a fresh project with the newest QCAR SDK. All I changed was to view my model with the texture, instead of the teapot.

The texture is completely unaligned with the model. The model renders fine with the texture in MeshLab.

I used the popular Phyton script to convert .obj -> .h and the code works flawlessly with the banana model used as example for this script.

 

Could there be a general reason for the bad alignment of the texture?  Otherwise I'll start posting screenshots and code.

Best regards

Igaz

Model rendered with misalligned texture

October 7, 2012 - 11:39am #2

Indeed, flipping the texture image upside down solves the problem;

if you don't want to flip the image, you can otherwise flip the vertical component of the texture coordinates array,

something like:

for (int i = 0; i < meshNumVertices; ++i)

{

flippedTexCoords[2*i + 0] = meshTexCoords[2*i+0]; // u coord

flippedTexCoords[2*i + 1] = 1.0f - meshTexCoords[2*i+1]; // flipped v coord

}

 

 

Log in or register to post comments