I have almost finished my own 3D Modeler but am having some problems with assigning texture coords
I have wrote some routines to assign texture coords but none apply the way I want to my object.
Basically the problem is this.
I have used vertex and index buffers to build my objects from my own file format.
Imagine you have a cube and texture coords that go around the cube from 0.0 to 1.0. If you write a function to loop through each vertex and assign a coordinate then you get somethin like 0.0, 0.5, 1.0, 0.5 so your texture wraps around 2 sides then mirrors around the other 2 along the x and z axis. What I want is texture coordinates of 0.0, 0.25, 0.75, 1.0. This would be easy but with index buffers each corner of the cube is 1 vertex not 3 because 3 faces use the same vertex. So in effect your start vertex of 0.0 also has to be 1.0 because the right hand side of the texture has to join to the left hand side of the texture as it wraps around the object.
A Vertex as far as I know can only have 1 set of uv coords so how can it be 0.0 and 1.0 so the whole texture is stretched around the object and finishes at the vertex it starts from???????
This is really digging at my brain now and I can't come up with a simple way of making 1 vertex represent 2 texture coords at the same time.
Does anybody know?
Many thanks in advance.
I have wrote some routines to assign texture coords but none apply the way I want to my object.
Basically the problem is this.
I have used vertex and index buffers to build my objects from my own file format.
Imagine you have a cube and texture coords that go around the cube from 0.0 to 1.0. If you write a function to loop through each vertex and assign a coordinate then you get somethin like 0.0, 0.5, 1.0, 0.5 so your texture wraps around 2 sides then mirrors around the other 2 along the x and z axis. What I want is texture coordinates of 0.0, 0.25, 0.75, 1.0. This would be easy but with index buffers each corner of the cube is 1 vertex not 3 because 3 faces use the same vertex. So in effect your start vertex of 0.0 also has to be 1.0 because the right hand side of the texture has to join to the left hand side of the texture as it wraps around the object.
A Vertex as far as I know can only have 1 set of uv coords so how can it be 0.0 and 1.0 so the whole texture is stretched around the object and finishes at the vertex it starts from???????
This is really digging at my brain now and I can't come up with a simple way of making 1 vertex represent 2 texture coords at the same time.
Does anybody know?
Many thanks in advance.