Skip to main content
gamedev.net
🔒 Locked

Textures values

Started by jazztuffy Sep 6, 2006 at 6:52 PM 0 replies 650+ views
Original Post
jazztuffy
jazztuffy
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, ▭, 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????
ET3D
ET3D
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.