Archived

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

Scarface5013

copying RECT form Texture

Recommended Posts

this is my code. i wan to copy a piece of texture in an other. i''m using memcopy. my code don''t work . why ?? when drawing nothing is to see. HRESULT Failure; D3DLOCKED_RECT LkRect1; D3DLOCKED_RECT LkRect2; Failure = pTexture->LockRect( 0, &LkRect1, &( SpritesCoordinates[ SpriteNum ] ), D3DLOCK_NOSYSLOCK ); Failure = g_pd3dDevice->CreateTexture( 64, 64, 0, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pSpriteTexture ); Failure = pSpriteTexture->LockRect( 0, &LkRect2, NULL , D3DLOCK_NOSYSLOCK ); // Kopieren der Pixel BYTE* pData1 = ( BYTE* )( LkRect1.pBits ); BYTE* pData2 = ( BYTE* )( LkRect2.pBits ); memcpy( pData2, pData1, 64 * 64 * BYTESPERPIXEL ); // Unlocken der Texturen Failure = pTexture->UnlockRect( 0 ); pSprite->Begin(); Failure = pSprite->Draw(pSpriteTexture, NULL, &Scaling, &RotCenter, Rotation, &Translation, ModulateColor); pSprite->End();

Share this post


Link to post
Share on other sites