• Advertisement
Sign in to follow this  

procedural texture

This topic is 3594 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

Advertisement
The D3DLOCKED_RECT structure has a pBits member which points to the data and a Pitch member which says how many bytes per row. Accessing a specific pixel would depend on the texture format, but assuming A8R8G8B8, the address of the pixel (x,y) (both in range 0 to 255) would be:

reinterpret_cast<uint32_t*>(pBits) + y * Pitch + x

Share this post


Link to post
Share on other sites
Also, to convert your color from seperate R, G, B and A components, you can use the D3DCOLOR_RGBA macro (or any of the D3DCOLOR_* macros). D3DCOLOR_RGBA expects values in the 0..255 range.

If you're hardcoding values, you can use hex format to get the color simply:
(example for bright green, with 255 alpha)
D3DCOLOR myColor = 0xFF00FF00;

The format is 0xAARRGGBB.

Hope this helps.

Share this post


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

  • Advertisement