tmason

07-09-2014, 04:50 AM

Hello,

I am using a loading library which supplies UV coordinates as shown below.

Note that these coordinates are not in the range of 0.0 - 1.0

Therefore the textures aren't mapping properly and the end results suck.

I tried using GLSL's clamp as shown below in the fragment shader but that doesn't work.

How do I work with these UV coordinates?

Thank you for your time:

GLSL shader snippet:

MaterialTextureColor = texture2D(MainTextureSampler, clamp(TextureCoordinates, 0, 1));

UV Coordinates:

Note that this is just a textual representation, the coordinates are floats within C++/OpenGL when loaded.

UV Point: S: -53.0558 T: -15.3896

UV Point: S: 5.99937 T: -15.3896

UV Point: S: -3.84315 T: 2.00539

UV Point: S: -3.84315 T: 2.00539

UV Point: S: 5.99937 T: -15.3896

UV Point: S: 5.99937 T: 2.00539

UV Point: S: -53.0558 T: -15.3896

UV Point: S: -3.84315 T: 2.00539

UV Point: S: -53.0558 T: 4.29541

UV Point: S: -3.84315 T: 4.29541

UV Point: S: -53.0558 T: 4.29541

UV Point: S: -3.84315 T: 2.00539

UV Point: S: -3.84315 T: -2.00539

UV Point: S: -53.0558 T: -4.29541

UV Point: S: -3.84315 T: -4.29541

UV Point: S: -3.84315 T: -2.00539

UV Point: S: 5.99937 T: 15.3896

UV Point: S: -53.0558 T: 15.3896

UV Point: S: 5.99937 T: 15.3896

UV Point: S: -3.84315 T: -2.00539

UV Point: S: 5.99937 T: -2.00539

UV Point: S: -3.84315 T: -2.00539

UV Point: S: -53.0558 T: 15.3896

UV Point: S: -53.0558 T: -4.29541

UV Point: S: -2.00539 T: -0.492126

UV Point: S: 15.3896 T: -0.492126

UV Point: S: 15.3896 T: 3.75462e^-009

UV Point: S: 15.3896 T: 3.75462e^-009

UV Point: S: -2.00539 T: 3.75462e^-009

UV Point: S: -2.00539 T: -0.492126

UV Point: S: -3.84315 T: -0.492126

UV Point: S: 5.99937 T: -0.492126

UV Point: S: 5.99937 T: 3.75462e^-009

UV Point: S: 5.99937 T: 3.75462e^-009

UV Point: S: -3.84315 T: 3.75462e^-009

UV Point: S: -3.84315 T: -0.492126

UV Point: S: -4.29541 T: -0.492126

UV Point: S: -2.00539 T: -0.492126

UV Point: S: -2.00539 T: 3.75462e^-009

UV Point: S: -2.00539 T: 3.75462e^-009

UV Point: S: -4.29541 T: 3.75462e^-009

UV Point: S: -4.29541 T: -0.492126

UV Point: S: -53.0557 T: -0.492126

UV Point: S: -3.84315 T: -0.492126

UV Point: S: -53.0557 T: 3.75462e^-009

UV Point: S: -3.84315 T: 3.75462e^-009

UV Point: S: -53.0557 T: 3.75462e^-009

UV Point: S: -3.84315 T: -0.492126

UV Point: S: -15.3896 T: -0.492126

UV Point: S: 4.29541 T: -0.492126

UV Point: S: 4.29541 T: 3.75462e^-009

UV Point: S: 4.29541 T: 3.75462e^-009

UV Point: S: -15.3896 T: 3.75462e^-009

UV Point: S: -15.3896 T: -0.492126

UV Point: S: 5.99937 T: 0.492126

UV Point: S: -53.0558 T: 0.492126

UV Point: S: -53.0558 T: -3.75462e^-009

UV Point: S: -53.0558 T: -3.75462e^-009

UV Point: S: 5.99937 T: -3.75462e^-009

UV Point: S: 5.99937 T: 0.492126

I am using a loading library which supplies UV coordinates as shown below.

Note that these coordinates are not in the range of 0.0 - 1.0

Therefore the textures aren't mapping properly and the end results suck.

I tried using GLSL's clamp as shown below in the fragment shader but that doesn't work.

How do I work with these UV coordinates?

Thank you for your time:

GLSL shader snippet:

MaterialTextureColor = texture2D(MainTextureSampler, clamp(TextureCoordinates, 0, 1));

UV Coordinates:

Note that this is just a textual representation, the coordinates are floats within C++/OpenGL when loaded.

UV Point: S: -53.0558 T: -15.3896

UV Point: S: 5.99937 T: -15.3896

UV Point: S: -3.84315 T: 2.00539

UV Point: S: -3.84315 T: 2.00539

UV Point: S: 5.99937 T: -15.3896

UV Point: S: 5.99937 T: 2.00539

UV Point: S: -53.0558 T: -15.3896

UV Point: S: -3.84315 T: 2.00539

UV Point: S: -53.0558 T: 4.29541

UV Point: S: -3.84315 T: 4.29541

UV Point: S: -53.0558 T: 4.29541

UV Point: S: -3.84315 T: 2.00539

UV Point: S: -3.84315 T: -2.00539

UV Point: S: -53.0558 T: -4.29541

UV Point: S: -3.84315 T: -4.29541

UV Point: S: -3.84315 T: -2.00539

UV Point: S: 5.99937 T: 15.3896

UV Point: S: -53.0558 T: 15.3896

UV Point: S: 5.99937 T: 15.3896

UV Point: S: -3.84315 T: -2.00539

UV Point: S: 5.99937 T: -2.00539

UV Point: S: -3.84315 T: -2.00539

UV Point: S: -53.0558 T: 15.3896

UV Point: S: -53.0558 T: -4.29541

UV Point: S: -2.00539 T: -0.492126

UV Point: S: 15.3896 T: -0.492126

UV Point: S: 15.3896 T: 3.75462e^-009

UV Point: S: 15.3896 T: 3.75462e^-009

UV Point: S: -2.00539 T: 3.75462e^-009

UV Point: S: -2.00539 T: -0.492126

UV Point: S: -3.84315 T: -0.492126

UV Point: S: 5.99937 T: -0.492126

UV Point: S: 5.99937 T: 3.75462e^-009

UV Point: S: 5.99937 T: 3.75462e^-009

UV Point: S: -3.84315 T: 3.75462e^-009

UV Point: S: -3.84315 T: -0.492126

UV Point: S: -4.29541 T: -0.492126

UV Point: S: -2.00539 T: -0.492126

UV Point: S: -2.00539 T: 3.75462e^-009

UV Point: S: -2.00539 T: 3.75462e^-009

UV Point: S: -4.29541 T: 3.75462e^-009

UV Point: S: -4.29541 T: -0.492126

UV Point: S: -53.0557 T: -0.492126

UV Point: S: -3.84315 T: -0.492126

UV Point: S: -53.0557 T: 3.75462e^-009

UV Point: S: -3.84315 T: 3.75462e^-009

UV Point: S: -53.0557 T: 3.75462e^-009

UV Point: S: -3.84315 T: -0.492126

UV Point: S: -15.3896 T: -0.492126

UV Point: S: 4.29541 T: -0.492126

UV Point: S: 4.29541 T: 3.75462e^-009

UV Point: S: 4.29541 T: 3.75462e^-009

UV Point: S: -15.3896 T: 3.75462e^-009

UV Point: S: -15.3896 T: -0.492126

UV Point: S: 5.99937 T: 0.492126

UV Point: S: -53.0558 T: 0.492126

UV Point: S: -53.0558 T: -3.75462e^-009

UV Point: S: -53.0558 T: -3.75462e^-009

UV Point: S: 5.99937 T: -3.75462e^-009

UV Point: S: 5.99937 T: 0.492126