Sign in to follow this  
jazztuffy

Textures values

Recommended Posts

Hi Guyz, just look at this chunk of code.... A is a "5X5" matrix. LPDIRECT3DTEXTURE9 pTexture = NULL; Device->CreateTexture( 5, 5, 1, 0, D3DFMT_R32F, D3DPOOL_SYSTEMMEM, &pTexture, 0); RECT rect; rect.top = rect.left = 0; rect.bottom = 5; rect.right = 5; D3DLOCKED_RECT lockedRect; pTexture->LockRect(0, &lockedRect, &rect, 0) ; memcpy(lockedRect.pBits, A, 5*5*sizeof(float)); lockedRect.Pitch = 5; Look at "memcpy" is it true that lockedRect holds the color values fromed out of matrix elements....if it is how are the elements decomposed to RGB values... If my question doesnt make sense can you explain me the code????

Share this post


Link to post
Share on other sites
This code won't work. The pitch is something returned by the lock function, not something you set. You have to copy each row separately, and start it according to the pitch.

This recent thread has some more explanation and code about the pitch.

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