• Advertisement
Sign in to follow this  

Textures values

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

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
Advertisement
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
Sign in to follow this  

  • Advertisement