Archived

This topic is now archived and is closed to further replies.

Texture Tiling?

This topic is 5018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to tile some textures, loaded from an x file. Please can anyone point me in the right direction or give my a method name that will do it. Many thanks, all sugestions are welcome.

Share this post


Link to post
Share on other sites
To tile a texture you simply increase the uv co-ordinates. e.g. to tile it 8 times across and 8 down you set bottom right uv to 8,8

Share this post


Link to post
Share on other sites
Yes, thanks,thats easy enough with my custom vertex buffers, but with a mesh a havent quite got it working. I have locked the buffer (not to read only)an wrote the new uv but I cant figure out how to make the change permanent in runtime and in as few statemensts as possible (im wondering if i need to recreate this data as a new mesh, and reload it)?

Anybody got a suggestion.
Thanks ...

Share this post


Link to post
Share on other sites
just to clarify. I can modify a copy of the vertices but can''t set it.


repeat
hr = D3DXLoadMeshFromX(Path, D3DXMESH_SYSTEMMEM, m_pD3DDevice, NULL, &m_pMaterialBuf, NULL,&Mesh[j].m_dwNumMaterials, &Mesh[j].pMesh );

loop for n meshes
if tiled
Mesh[j].pMesh->LockVertexBuffer(D3DLOCK_NOSYSLOCK,(void**)&pVB);

Mesh[j].pMesh->GetVertexBuffer(pVB);

pVB->tu = 8.0;
pVB->tv = 8.0;

Mesh[j].pMesh->UnlockVertexBuffer();
// ??? set the change
endif
end loop
...
end

IT''''s Geeky

Share this post


Link to post
Share on other sites
Thats the right idea but you are not doing it correctly. Firstly you get the vertex buffer then you lock it which returns a pointer to the vertex data, you must cast this to your FVF (make sure it is the correct one!) and then you can set each coord

edit: and this is not a copy of the vertex but the real thing

[edited by - Trip99 on March 21, 2004 5:00:12 PM]

Share this post


Link to post
Share on other sites
Cheers Jerry, I forgot about doing all of them. Now I''m going to need to find out which of the vertices to work on since this mesh has 4 sides and I want to tile only 1 of, on both sides differntly.

Share this post


Link to post
Share on other sites