The goal of my program is to display a simple cube UV mapped exported from Blender. But the texture mapping in my openGL program is not correct. I want to precise that the display of my UV mapped cube is perfect on Blender. My texture is composed of a simple color for each face(Red, green, blue, purple, yellow and orange). I've choosen to export my mesh in .obj and .mtl files using quads. Here's the content of my .obj file (I've added some comments):
# Blender v2.63 (sub 0) OBJ File: ''
# www.blender.org
mtllib Box.mtl
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
vt 0.500000 1.000000 //1
vt 0.250000 1.000000 //2
vt 0.250000 0.750000 //3
vt 0.500000 0.750000 //4
vt 0.500000 0.250000 //5
vt 0.500000 0.500000 //6
vt 0.250000 0.500000 //7
vt 0.250000 0.250000 //8
vt 0.500000 0.000000 //9
vt 0.250000 0.000000 //10
vt 0.000000 0.750000 //11
vt 0.000000 0.500000 //12
vt 0.750000 0.500000 //13
vt 0.750000 0.750000 //14
usemtl Material_Box.bmp
s off
f 1/1/1 2/2/1 3/3/1 4/4/1 //Orange OK
f 5/5/2 8/6/2 7/7/2 6/8/2 //Green OK
f 1/9/3 5/5/3 6/8/3 2/10/3 //Red OK
f 2/11/4 6/12/4 7/7/4 3/3/4 //White (should be purple) NOT OK
f 3/3/5 7/7/5 8/6/5 4/4/5 //Yellow 5 OK
f 5/13/6 1/14/6 4/4/6 8/6/6 //White (should be blue) NOT OK
My unwraped cube looks like a cross. Here's my UV texture (I want to precise that the '3bis' and '4bis' correspond to the .obj file wrong coordinates. Only the 1, 2, 5 and 6 faces coordinates are correct):
And here's an exemple of my openGL render :
You can see the '4bis' white face like on the uv texture.
So, certain coordinates generated by blender seems to be wrong. Why? Does the problem comes from that the blue quad doesn't touch the right side of the picture creating a translation of certains coordinates? Maybe I must precise a special parameter before exportation in Blender... Does anyone can help me?