Jump to content
  • Advertisement
Sign in to follow this  
xychzh

how to LockRect Texture like dxt5 format?

This topic is 2618 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 make the disable effect for button, and the texture is dxt5 format, so i need to modify the texture pixel
this is not same as the uncompress format, yes??
then how to LockRect this format??

thank you..

Share this post


Link to post
Share on other sites
Advertisement
You can LockRect it but it will give you access to the compressed texels. An alternative is to use something like D3DXLoadSurfaceFromSurface, which will handle decompression for you, then load it back on to the original texture, but it's not going to give you high performance and will be sending the texture through another compression step, which will cause a loss in quality. Best option is to use D3DFMT_X8R8G8B8 or D3DFMT_A8R8G8B8 for textures that you need to modify in this way.

Share this post


Link to post
Share on other sites

You can LockRect it but it will give you access to the compressed texels. An alternative is to use something like D3DXLoadSurfaceFromSurface, which will handle decompression for you, then load it back on to the original texture, but it's not going to give you high performance and will be sending the texture through another compression step, which will cause a loss in quality. Best option is to use D3DFMT_X8R8G8B8 or D3DFMT_A8R8G8B8 for textures that you need to modify in this way.



thank you
that is to say we can't directly modify this format pixel?
then for this dxt5 format, how to meke it gray??

Share this post


Link to post
Share on other sites
Locking the pixels and modifying them is the wrong solution to make a button grey. You should instead either use a pixel shader to make it grey, or have two different copies of the texture (on that is grey, and one that is not).

Share this post


Link to post
Share on other sites

Locking the pixels and modifying them is the wrong solution to make a button grey. You should instead either use a pixel shader to make it grey, or have two different copies of the texture (on that is grey, and one that is not).


my project is not use shader, i make 2d game with d3d9?i render texture with XYZRHW and DrawPrimitiveUp.?
so i often use this way to modify pixels.
if not, i have to prepare a gray texture additional.
thank you

Share this post


Link to post
Share on other sites

Making a DXT texture grey on the fly isn't that hard. The compressed data format holds raw 5:6:5 colours which you can modify. You just need to work out where they are stored.



thanks
i'll see what i can do..

Share this post


Link to post
Share on other sites
Or if all you want to do is greyscale it you could use a D3DTOP_DOTPRODUCT3 TextureStageState blend with either a texture, a temp color or a constant color having R/G/B in the proportions 0.3/0.59/0.11.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!