Jump to content
  • Advertisement
Sign in to follow this  
g4br1e1

Could Not Load From BackBuffer using a .bmp file (offscreenPlainSurface)

This topic is 2619 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

Attached is the code I am using to create a Offscreenplainsurface using a bitmap image named as "background.bmp".
I am clearing the screen to the blue screen initially and then obtaining the image from the backbuffer.

After running the program, view filled only with blue color gets rendered and not the bitmap image.
Kindly suggest.

Following is the error that comes up when I enabled debugging using DirectX.

Direct3D9: (ERROR) :Invalid source surface interface specified. StretchRect fails

I could not find any issue with the code. I am simply returning the "surface" reference into the "bkgrd"; which in turn is being used in:

pd3dDevice->StretchRect(bkgrd,NULL,backbuffer,NULL,D3DTEXF_NONE);


IDirect3DSurface9* getSurfaceFromBitmap()
{
IDirect3DSurface9* surface=NULL;
HRESULT hResult=pd3dDevice->CreateOffscreenPlainSurface(640,480,D3DFMT_X8R8G8B8,D3DPOOL_DEFAULT,&surface,NULL);
if(FAILED(hResult))
return NULL;

hResult = D3DXLoadSurfaceFromFile(surface,NULL,NULL,"background.bmp",NULL,D3DX_DEFAULT,0,NULL);
if(FAILED(hResult))
return NULL;

return surface;
}

bkgrd = getSurfaceFromBitmap();


Does resource file has anything to do with this.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!