Been trying to map my texture on a cube. The first front bue is easy to visualize. But the sides and back and the bottom and top becomes harder. say for example this
I draw the only half of the square for better visualization. From this tutorial the texture coordinate is something like this
The case is If I am going to move my camera so that the left side becomes the front it will look like this
This is the vertex coord for this image
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
If i will base the mapping of the coord to this image
if you look closely, the
-0.5f, -0.5f, -0.5f,
should be map at 0.0f, 0.0f, not on 0.0f, 1.0f. Note that the image is the left side of the cube. I just move the camera to and make the scene the left side to appear on front,to better visualize the mapping.
-0.5f, -0.5f, 0.5f, should be at 1.0f, 0.0f and -0.5f, 0.5f, 0.5f, should be at 1.0f, 1.0f.
If i will follow the coorect texture coords this is what I will get
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
-0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
The could should be right. If I will base the tutorial to that.
How do you manage to correctly map a 2D texture on a cube specially when it comes to side, bottom and top. Do you visualize each side as 2D and imagine positioning the camera to make the side on front and then map the 2D? just like I did here? or something else?
Thanks