Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Qpeg

IDirect3DTexture9::LockRect()

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

I''m writing a function in my sprite class to be able to get pixel data from a given point (x,y) do so simple collition detection. Here''s the rutine: D3DCOLOR MBGSprite::GetPixel(int x, int y) { D3DLOCKED_RECT LockedRect; m_pSrcTexture->LockRect(0, &LockedRect, NULL, D3DLOCK_READONLY); LockedRect.Pitch /=4; DWORD* pData=(DWORD*)(LockedRect.pBits); D3DCOLOR temp = pData[y*LockedRect.Pitch + x]; m_pSrcTexture->UnlockRect(0); return temp; } pData[y*LockedRect.Pitch + x] causes an access violation. When i output the size of pitch, its is 0 and pData = 4. Does this mean the texture is not extracted properly?

Share this post


Link to post
Share on other sites
Advertisement
D3DXCreateTextureFromFileEx(
m_pDevice,
PathName,
m_info.Width,
m_info.Height,
m_info.MipLevels,
0,
m_info.Format ,
D3DPOOL_DEFAULT,
D3DX_DEFAULT,
D3DX_DEFAULT,
m_modulateColor,
NULL,
NULL,
&m_pSrcTexture);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!