Help with OpenGL Uv Coordonates

Started by Mihai_Ionut_Floares, December 02, 2020, 23:01:50

Previous topic - Next topic


I succeeded import meshes, but the UV are very weird. Look how it applies a dirt texture to suzane:

And look how it should apply:

(Don't ask me why do I want a dirt textured monkey)

If the model loading works(vertices), the uvs should work too because they are using the same algorithm. Plus, the uvs are exported in obj file from blender with triangulated faces.
That's how shader process the uvs from obj:
layout(location = 1) in vec2 vertexUV;void main(){
	gl_Position = Proj * View * Model * vec4(vertexPosition_modelspace,1);
 	UV = vertexUV;


in vec2 UV;
out vec4 color;

uniform sampler2D myTextureSampler;

void main(){
	color = texture( myTextureSampler, UV ).rgba;