- Joined
- Dec 13, 2013
- Messages
- 63
- Reaction score
- 10
I'm trying to pass the buffer to a texture so I can draw it, the only way I found it was this:
By doing this, the game crashThe site documentation informs you that the size is width * height * 4
"On Windows |buffer| will be width*height*4 bytes in size and represents a BGRA image with an upper-left origin"
Is there any way to pass the buffer to the texture?
Code:
definitions(...)
IDirect3DTexture9* tx;
Init(...)
RGetDevice()->CreateTexture(RGetScreenWidth(), RGetScreenHeight(), 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, &tx, NULL);
void(.., int width, int height, void* buffer){
D3DLOCKED_RECT d3dLockedRect;
tx->LockRect(0, &d3dLockedRect, 0, 0);
memcpy(d3dLockedRect.pBits, buffer, width *height* 4);
tx->UnlockRect(0);}
"On Windows |buffer| will be width*height*4 bytes in size and represents a BGRA image with an upper-left origin"
Is there any way to pass the buffer to the texture?