Log in or register to post comments

2D Texture scaling issue

October 13, 2013 - 8:57am #1

Hi,

I've modified CloudReco example to track my own image and display my own 2D texture.

For some reasone the texture rendering has a wrong scale, and it (the texture) doesn't fit to the right size of the image targer - it looks much smaller.

I recheked the image target size on the cloud and they seem correct. I also checked that the 2D (png) texture is loaded to the right dimensions. 
What could go wrong?

Thank!

2D Texture scaling issue

October 13, 2013 - 11:12am #3

Thanks David!

I think I found the reason:
First I had to modify quadVertices s.t: static const float quadVertices[NUM_QUAD_VERTEX * 3] =

{ -1.00f, -1.00f, 0.0f, 1.00f, -1.00f, 0.0f, 1.00f, 1.00f, 0.0f, -1.00f, 1.00f,

        0.0f, };

 

Second I had to use targetSize for scaling:

 

SampleUtils::scalePoseMatrix(targetSize.data[0], 

    targetSize.data[1],

            1.0f,

            &modelViewMatrix.data[0]);

 

Now it seems to fit the image target.
 

2D Texture scaling issue

October 13, 2013 - 10:37am #2

Check that your image is in the plane of the target, not far above or below it.

How are you implementing the 2D texture?  My advice is to apply the image to a 3D Plane.

Log in or register to post comments