Sounds like you want to do UV mapping.
Check out these explanations of the AddTriangle and AddVertex commands. They describe a bit how UV mapping works.
AddVertex ( surface,x#,y#,z#[,u#][,v#][,w#] )
Parameters
surface - surface handle
x# - x coordinate of vertex
y# - y coordinate of vertex
z# - z coordinate of vertex
u# (optional) - u texture coordinate of vertex
v# (optional) - v texture coordinate of vertex
w# (optional) - w texture coordinate of vertex - not used, included for future expansion
Description
Adds a vertex to the specified surface and returns the vertices' index number, starting from 0.
x,y,z are the geometric coordinates of the vertex, and u,v,w are texture mapping coordinates.
A vertex is a point in 3D space which is used to connect edges of a triangle together. Without any vertices, you can't have any triangles. At least three vertices are needed to create one triangle; one for each corner.
The optional u, v and w parameters allow you to specify texture coordinates for a vertex, which will determine how any triangle created using those vertices will be texture mapped. The u, v and w parameters specified will take effect on both texture coordinate sets (0 and 1). This works on the following basis:
The top left of an image has the uv coordinates 0,0.
The top right has coordinates 1,0
The bottom right is 1,1.
The bottom left 0,1.
Thus, uv coordinates for a vertex correspond to a point in the image. For example, coordinates 0.9,0.1 would be near the upper right corner of the image.
So now imagine you have a normal equilateral triangle. By assigning the bottom left vertex a uv coordinate of 0,0, the bottom right a coordinate of 1,0 and the top centre 0.5,1, this will texture map the triangle with an image that fits it.
When adding a vertex its default color is 255,255,255,255.
AddTriangle ( surface,v0,v1,v2 )
Parameters
surface - surface handle
v0 - index number of first vertex of triangle
v1 - index number of second vertex of triangle
v2 - index number of third vertex of triangle
Description
Adds a triangle to a surface and returns the triangle's index number, starting from 0.
The v0, v1 and v2 parameters are the index numbers of the vertices created using AddVertex.
Depending on how the vertices are arranged, then the triangle will only be visible from a certain side. Imagine that a triangle's vertex points are like dot-to-dot pattern, each numbered v0, v1, v2. If these dots, starting from v0, through to V2, form a clockwise pattern relative to the viewer, then the triangle will be visible. If these dots form an anti-clockwise pattern relative to the viewer, then the triangle will not be visible.
The reason for having one-sided triangles is that it reduces the amount of triangles that need to be rendered when one side faces the side of an object which won't be seen (such as the inside of a snooker ball). However, if you wish for a triangle to be two-sided, then you can either create two triangles, using the same set of vertex numbers for both but assigning them in opposite orders, or you can use CopyEntity and FlipMesh together.
Using the commands above you can manually texture your meshes. Try it on a few simpler meshes (plane, cube, 2D circle, cylinder) to get an idea for how it works.
I would suggest using a 3rd party program to do the uvmapping for you though. An excellent program I use is Blender. Although there is a steep learning curve. Click on the "About Blender" button on the web page to download it.
BTW, did you make the changes to your code that I suggested above?
Check out these explanations of the AddTriangle and AddVertex commands. They describe a bit how UV mapping works.
AddVertex ( surface,x#,y#,z#[,u#][,v#][,w#] )
Parameters
surface - surface handle
x# - x coordinate of vertex
y# - y coordinate of vertex
z# - z coordinate of vertex
u# (optional) - u texture coordinate of vertex
v# (optional) - v texture coordinate of vertex
w# (optional) - w texture coordinate of vertex - not used, included for future expansion
Description
Adds a vertex to the specified surface and returns the vertices' index number, starting from 0.
x,y,z are the geometric coordinates of the vertex, and u,v,w are texture mapping coordinates.
A vertex is a point in 3D space which is used to connect edges of a triangle together. Without any vertices, you can't have any triangles. At least three vertices are needed to create one triangle; one for each corner.
The optional u, v and w parameters allow you to specify texture coordinates for a vertex, which will determine how any triangle created using those vertices will be texture mapped. The u, v and w parameters specified will take effect on both texture coordinate sets (0 and 1). This works on the following basis:
The top left of an image has the uv coordinates 0,0.
The top right has coordinates 1,0
The bottom right is 1,1.
The bottom left 0,1.
Thus, uv coordinates for a vertex correspond to a point in the image. For example, coordinates 0.9,0.1 would be near the upper right corner of the image.
So now imagine you have a normal equilateral triangle. By assigning the bottom left vertex a uv coordinate of 0,0, the bottom right a coordinate of 1,0 and the top centre 0.5,1, this will texture map the triangle with an image that fits it.
When adding a vertex its default color is 255,255,255,255.
Example Graphics3D 640,480 SetBuffer BackBuffer() mesh = CreateMesh() surf = CreateSurface(mesh) v0 = AddVertex (surf, -5,-5,0, 0 ,0) v1 = AddVertex (surf, 5,-5,0, 1 ,0) v2 = AddVertex (surf, 0, 5,0, 0.5,1) tri = AddTriangle (surf,v0,v2,v1) cam = CreateCamera() MoveEntity cam, 0,0,-7 RenderWorld Flip WaitKey End
AddTriangle ( surface,v0,v1,v2 )
Parameters
surface - surface handle
v0 - index number of first vertex of triangle
v1 - index number of second vertex of triangle
v2 - index number of third vertex of triangle
Description
Adds a triangle to a surface and returns the triangle's index number, starting from 0.
The v0, v1 and v2 parameters are the index numbers of the vertices created using AddVertex.
Depending on how the vertices are arranged, then the triangle will only be visible from a certain side. Imagine that a triangle's vertex points are like dot-to-dot pattern, each numbered v0, v1, v2. If these dots, starting from v0, through to V2, form a clockwise pattern relative to the viewer, then the triangle will be visible. If these dots form an anti-clockwise pattern relative to the viewer, then the triangle will not be visible.
The reason for having one-sided triangles is that it reduces the amount of triangles that need to be rendered when one side faces the side of an object which won't be seen (such as the inside of a snooker ball). However, if you wish for a triangle to be two-sided, then you can either create two triangles, using the same set of vertex numbers for both but assigning them in opposite orders, or you can use CopyEntity and FlipMesh together.
Using the commands above you can manually texture your meshes. Try it on a few simpler meshes (plane, cube, 2D circle, cylinder) to get an idea for how it works.
I would suggest using a 3rd party program to do the uvmapping for you though. An excellent program I use is Blender. Although there is a steep learning curve. Click on the "About Blender" button on the web page to download it.
BTW, did you make the changes to your code that I suggested above?