Jump to content
  • Advertisement
Sign in to follow this  
Jiia

1x1 Mip == Color

This topic is 4851 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 just have a quick question. That means I'll probably spend several hours or days trying to figure this out. I'm about to lock a 1x1 texture surface that is guaranteed to be stored in D3DFMT_X8R8G8B8 format. But I'm not positive about what's inside. Is it just a D3DCOLOR component? Or do I need to unscramble the color components depending on videocard preferenced formats and such? I'm going to try it anyway. But just because it works for me doesn't mean I'm doing it right. That's why I'm asking. Thanks [smile] edit: It works [smile] But is it a bad assumption?

Share this post


Link to post
Share on other sites
Advertisement
No, it's not a bad assumption.

With a 1x1 D3DFMT_X8R8G8B8 texture (or mip map level), the first DWORD will always be a valid colour value.


A couple of things you should be aware of though:

1) because the upper 8 bits of the format are X8 rather than A8, don't make any assumptions about what will be in those 8 bits - it could be 0; it could be 255; it could be random junk.

2) once the height of the texture is greater than 1 (e.g. 1x2), you shouldn't make any assumptions about what will be in the 2nd DWORD. If height>1, then pay attention to the pitch in the locked rect structure.

Share this post


Link to post
Share on other sites
Thanks for the tips. Actually, I hadn't even thought about the unknown alpha component. I had to add an extra A=255 line [smile]

You probably just saved me hours of later debugging. Unfortunately, my rating for ya is already maxed out.

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!