Archived

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

jmhill2

GetBackBuffer directx 9

Recommended Posts

jmhill2    122
hey guys, i''m trying to load a bitmap from a file, i first get the bitmap header info, then create a plain surface, use loadsurfacefromfile to load the image, and then i want to copy this surface to the backbuffer, but when i do i run into problems, the compiler says that the GetBackBuffer routine is undeclared. I have included the following headers & libs: d3d9.h,d3dx9.h,dxerr9.h, i''m using vc++6 and I have add the libs to the linker path. I can''t figure why its not recognizing the function, what gives???? thanks /*code snip*/ int cSurface::CopySurfaceToBackBuffer(cDirectX * directX){ HRESULT result; IDirect3DSurface9* pBackBuffer = NULL; /*get pointer to back buffer*/ result = GetBackBuffer( <---error 0,0,D3DBACKBUFFER_TYPE_MONO,&pBackBuffer); if(FAILED(result)) return 0; /*copy bitmap between surfaces*/ result = directX->g_pd3dDevice->StretchRect(Surface,NULL,pBackBuffer,NULL,D3DTEXF_NONE); if(FAILED(result)) return 0; return 1; } /*end code snip*/ "Genius is rare because the means of becoming one has not been made commonly available."

Share this post


Link to post
Share on other sites
Boogiemike    122
Hi!

You should call the function like this:

if( SUCCEEDED( m_pd3dDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer) ) )
{
// Process your code here


// Release BackBuffer to prevent from memory leaks

pBackbuffer->Release();
}

Hope it helps.

Share this post


Link to post
Share on other sites
jmhill2    122
thanks, I don''t know why i didn''t try that, funny thing is the book I''m going over "Direct 3D programming QuickStart" shows it as an independant function. hmmmm.

Share this post


Link to post
Share on other sites