Archived

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

Seems simple, but I am having problem blitting to back buffer.

This topic is 5337 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 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]

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.


    
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]

Share this post


Link to post
Share on other sites
I think I found out what is going on, seems my video card is doing something called tiling with the back buffer.


[edited by - CptanPanic on May 9, 2003 12:15:08 PM]

Share this post


Link to post
Share on other sites