Seems simple, but I am having problem blitting to back buffer.
I am setting the pixels directly on a surface, and copying that to the back buffer. But I can't get anything to come out correct. I tried just doing a straight horizontal line 400 pixels long, and it comes out as a line about 50 pixels long and 10 high. I took a screen shot to show what I mean. I verified that it is indeed writing 400 white 32 bit pixels every 4 bytes. Note I am running in 640x480.
Thanks,
CP
[edited by - CptanPanic on May 9, 2003 1:07:21 AM]
Rather difficult to say what the problem is without seeing the source or getting a lot more information.
2 obvious questions though:
1) Are you sure the backbuffer surface is 32 bit?
2) Do you know about framebuffer pitch and why it is important?
2 obvious questions though:
1) Are you sure the backbuffer surface is 32 bit?
2) Do you know about framebuffer pitch and why it is important?
Yes I understand that the pitch is the width of a row in bytes. I looked up the pitch and it is 2560, which divided by 32bits, comes out to 640. Below is what I am doing.
[edited by - CptanPanic on May 8, 2003 11:07:37 AM]
[edited by - CptanPanic on May 8, 2003 11:08:48 AM]
DWORD *m_pFinalVideoData = (DWORD *)VirtualAlloc(NULL, 4 * m_iWidth * m_iHeight, MEM_COMMIT, PAGE_READWRITE);;m_pd3dDevice->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_pBackBufferSurface) // Draw a Test Line. for(int i = 0; i < m_iWidth; i++) { m_pFinalVideoData[i + 240 * m_iWidth] = 0xFFFFFFFF; } if(FAILED(m_pBackBufferSurface->LockRect(&m_SurfaceRect, NULL, NULL))) { OutputDebugString("Unable to Lock Back Buffer\n"); return; } memcpy(m_SurfaceRect.pBits,m_pFinalVideoData, m_SurfaceRect.Pitch* m_iHeight); m_pBackBufferSurface->UnlockRect();
[edited by - CptanPanic on May 8, 2003 11:07:37 AM]
[edited by - CptanPanic on May 8, 2003 11:08:48 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement