Skip to main content
gamedev.net
🔒 Locked

procedural texture-wrapping problem

Started by Thek 1 reply 600+ views
Original Post
Thek
Thek
I'm having a strange problem with texture wrapping of the D3DTADDRESS_WRAP type. I am procedurally generating a cloud texture, then mapping it to a sky dome. I then animate the texture by incrementing the texture coordinates to make them move across the sky dome. Using the procedural texture, the texture smears across the sky after the texture coordinate excede [0.0, 1.0] (like D3DTADDRESS_CLAMP mode is set, which it isn't). If I replace the proceduaral texture with one loaded from file, the wrapping works without a hitch. I create the textures like this: // The procedural texture D3DXCreateTexture( gDevice, _textureSize, _textureSize, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &_finalTexture ); // The loaded texture D3DXCreateTextureFromFile( gDevice, "data//txtr//cloud.tga", &_texture ); I'm incremeting the texture coordinates like this: for (int index = 0; index < _numVertices; ++index) { _verts[index].tu += inc; } Anyone have any idea what's wrong here? I'm more than a little confused. [edited by - Thek on November 19, 2003 9:33:44 PM]
"There are three kinds of people in the world: those who can count, and those who can't."
Thek
Thek
Well, for anyone that cares, I did eventually figure this problem out. It isn''t a texture problem, but a vertex problem with the sky dome I was drawing on. I was creating the vertex buffer with D3DPOOL_DEFAULT, but on a whim I changed to D3DPOOL_MANAGED, and everything works fine.

~Thek
"There are three kinds of people in the world: those who can count, and those who can't."
hplus0603
hplus0603
Modifying a vertex buffer in-place when it''s DEFAULT pool is very bad (it may not work on some cards, and it''s likely to run very slow because it''s uncached memory).

Scrolling the texture by changing the vertex buffer is very inefficient, too. You should look into using the texture matrix (set it with SetTransform()).
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.