• Advertisement

Archived

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

Dynamic Texture Blending

This topic is 5157 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 am using dynamic tectures in the following way... pTexture = D3DXCreateTextureFromFileEx(...) pTexture->LockRect( 0, &rect, NULL, D3DLOCK_DISCARD ) copy data to texture pTexture->UnlockRect( 0 ); when I render a polygon with this texture I see both the original texture AND the new modified texture, as if the new texture data is being copied to another level and being blended with the original texture. I''m guessing the problem has to do with copying to the wrong texture or surface level. I''m just not sure how to fix this.

Share this post


Link to post
Share on other sites
Advertisement
If you''re using mipmapping, it could be filter between the mip levels (trilinear filtering).

Either:
1)Turn off trilinear filtering (set mipfilter to POINT)
2)When you create the texture set the MipLevels to 1, since you don''t seem to want to use them anyway, why create them?


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Setting filtering to point will still use the wrong level, it just won''t blend to it nicely, it''ll just suddenly jump to it.

If you actually do want mips, use GenerateMipSubLevels() or D3DXFilterTexture(). If you don''t then don''t create them to begin with wherever you create or load your texture.

Share this post


Link to post
Share on other sites
Thanks for the advice, shutting down the mipmap filter fixed the problem. I''m still wondering how this happened in the first place though. I''m not using or requesting any mipmap layers in the texture creation code, so where is the system storing the original texture?

Share this post


Link to post
Share on other sites
quote:
Original post by dragon9
Thanks for the advice, shutting down the mipmap filter fixed the problem. I''m still wondering how this happened in the first place though. I''m not using or requesting any mipmap layers in the texture creation code, so where is the system storing the original texture?


If you set the MipLevels to 0 or D3DX_DEFAULT in the call to D3DXCreateTextureFromFileEx it will create a full chain of them.

Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites

  • Advertisement