   texture streching problem
  hi, im having some trouble getting the texturing of some simple square right the texture is stretching across in a funny way. i think my problem is in the texture coordinates but i'm not sure. the funny things is that im using the same texture as on the ground at the moment and comes out fine. Heres what it looks like. http://img3.imageshack.us/i/oddtexturing.jpg/ as you can see the square with the circles around them are the ones with the problem. heres the code im using to initialize and draw these squares it pretty messy. anyone know why the textures are rendering this way?#include "global.h"LPDIRECT3DVERTEXBUFFER9 TempVertexBuffer;LPDIRECT3DTEXTURE9 TreeTexture;void RenderTrees(TreeObject* TreesToRender){D3DXMATRIX FillerMatrix;d3ddev->SetTexture(NULL, TreeTexture);d3ddev->SetTransform(D3DTS_WORLD, D3DXMatrixIdentity(&FillerMatrix));d3ddev->SetStreamSource(NULL, *TreesToRender->pVertexBufer, NULL, sizeof(vertexStructure));d3ddev->SetIndices(*TreesToRender->pIndexBuffer);HRESULT error3 = d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, TreesToRender->NumberOfTrees * 4, 0, TreesToRender->NumberOfTrees * 2);}TreeObject* InitTrees(void){static TreeObject Trees;vertexStructure TreeVertexs[40];Trees.NumberOfTrees = 10;HRESULT error = D3DXCreateTextureFromFileEx(d3ddev, "dirt.bmp", D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, NULL, NULL, NULL, &TreeTexture);for(int i = 0; i < Trees.NumberOfTrees * 4; i += 4) {TreeVertexs.x = i*2;TreeVertexs.y = 15;TreeVertexs.z = 10;TreeVertexs.u = 0;TreeVertexs.v = TreeVertexs.z - 10.0f;TreeVertexs.colour = 0xffffffff;TreeVertexs[i+1].x = TreeVertexs.x + 1;TreeVertexs[i+1].y = 15;TreeVertexs[i+1].z = 10;TreeVertexs[i+1].u = 1;TreeVertexs[i+1].v = TreeVertexs[i+1].z - 10.0f;TreeVertexs[i+1].colour = 0xffffffff;TreeVertexs[i+2].x = TreeVertexs[i+1].x;TreeVertexs[i+2].y = 15;TreeVertexs[i+2].z = 11;TreeVertexs[i+2].u = 1;TreeVertexs[i+2].v = TreeVertexs[i+2].z - 10.0f;TreeVertexs[i+2].colour = 0xffffffff;TreeVertexs[i+3].x = TreeVertexs.x;TreeVertexs[i+3].y = 15;TreeVertexs[i+3].z = 11;TreeVertexs[i+3].u = 0;TreeVertexs[i+3].v = TreeVertexs[i+3].z - 10.0f;TreeVertexs[i+3].colour = 0xffffffff;}d3ddev->SetFVF(CUSTOMFVF);HRESULT error2 = d3ddev->CreateVertexBuffer((Trees.NumberOfTrees * 4) * sizeof(vertexStructure), NULL, CUSTOMFVF, D3DPOOL_MANAGED, &TempVertexBuffer, NULL);void* pVertexBuffer;TempVertexBuffer->Lock(0, 0, (void**) &pVertexBuffer, NULL);memcpy(pVertexBuffer, TreeVertexs, sizeof(TreeVertexs));TempVertexBuffer->Unlock();Trees.pVertexBufer = &TempVertexBuffershort Indices[60];for(int i = 0; i < Trees.NumberOfTrees; ++i) {Indices[i*6] = i*4;Indices[i*6+1] = i*4+1;Indices[i*6+2] = i*4+2;Indices[i*6+3] = i*4+2;Indices[i*6+4] = i*4+3;Indices[i*6+5] = i*4;}static LPDIRECT3DINDEXBUFFER9 TempIndexBuffer;d3ddev->CreateIndexBuffer(Trees.NumberOfTrees * 6 * sizeof(short), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &TempIndexBuffer, NULL);void* pIndexBuffer;TempIndexBuffer->Lock(0, 0, (void**) &pIndexBuffer, NULL);memcpy(pIndexBuffer, Indices, sizeof(Indices));TempIndexBuffer->Unlock();Trees.pIndexBuffer = &TempIndexBufferreturn &Trees}