Sign in to follow this  

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

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.

[b]Direct3D9: (ERROR) :Invalid source surface interface specified. StretchRect fails[/b]

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:


[code]IDirect3DSurface9* getSurfaceFromBitmap()[attachment=5011:DirectX_1.txt]
IDirect3DSurface9* surface=NULL;
HRESULT hResult=pd3dDevice->CreateOffscreenPlainSurface(640,480,D3DFMT_X8R8G8B8,D3DPOOL_DEFAULT,&surface,NULL);
return NULL;

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

return surface;

[b]bkgrd = getSurfaceFromBitmap();[/b]

Does resource file has anything to do with this.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this