Sign in to follow this  
VprMatrix89

procedural texture

Recommended Posts

ET3D    810
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
sirob    1181
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this