   Texturing D3DX Shapes ?
  HiIf I create a shape like sphere Using D3DX (8.1)how can make this mesh accept texture ??regards 
  You need to establish texture coordinates for the geometry, ie. assigning every vertex a corresponding point in the texture space.I believe that none of the D3DX utility geometry functions generate the coordinates automatically, nor do they allocate even space for them in the mesh's vertex buffer.A simple way to allocate extra room for the texcoords in an existing mesh is to clone the mesh with a declaration requesting for memory for the coords, and then just generating/loading the coordinates for the cloned mesh, whichever is more appropriate for the situation. Google for more info, or look at the sdk -Nik   [edited by - Nik02 on February 8, 2004 2:06:28 PM];  Hii did search in poth sdk & google and found Nothing !you mean that i cannot change the coords in d3dx meshesand they are 0 for all vertexso there is no cure ? ;  I simply stated that D3DX functions do not calculate the coordinates for you automatically - therefore, if you want to texture the utility shapes, you have to add the texture coordinates yourself manually.kind rgds, NikPS. search in the sdk for "texture coordinates". I'm absolutely sure that the concept of them is explained there :DEDIT: When you have the mesh object, it's very easy to modify the geometry afterwards. Just lock the mesh's vertex buffer to get access to the geometry data. But do note that without the cloning process (described in my previous post) the buffer doesn't have memory for the texture coords.   [edited by - Nik02 on February 8, 2004 2:47:39 PM];HiI did clone the mesh for a FVF that have UVs so the tu and tv exist now ,, but they all 0but my quastion is how can access to the Mesh UVs to change the 0s ?there must be some way !and i am a visual basic programmer so i a have DX8.1 SDK for Visual Basic which does not have any information about how can i access to D3DXMesh UVs after I cloned it to FVF that have UV utility .. !! ;  GetVertexBuffer returns the VertexBuffer used by the mesh.  Meshes also support a LockVertexBuffer method. Stay Casual,KenDrunken Hyena;  Hi,I find the D3DXCreate[SomePrimitive]() functions are more trouble than they are worth. You are better off simply creating a sphere (or whatever) in 3DS Max, exporting it as an x-file and loading it up. ;  To modify the coords (or other geometry data) in VB, you need to make a copy from the vertex buffer to your own vertex array.The steps are:-Lock the vertex buffer, thus obtaining a pointer to it''s data.-Copy the data to your array, using DXCopyMemory function, passing "ByVal ptr" as src parameter (where "ptr" is the name of the lock pointer variable).-Modify your array''s data as needed.-Copy the array back to the vertex buffer.-Unlock the vertex buffer.This is one of the situations where using c++ would actually be much more simple - you could just use the pointer directly without redundant copying passes -Nik ;  HiI Will try this method until its works thank you very very much ;  If you need sample code, I could write some for fun (haven''t written anything in VB6 for a long time). But it''s a good idea to try this yourself, for practice - please ask only if you absolutely need a sample!-Nik 