Sign in to follow this  
johndirect

Present not displaying surfaces

Recommended Posts

Hi All, I have created a surface using CreateOffScreenPlainSurface and am trying to present it on the screen. But, I am not able to do so. I am not sure what is wrong with my code. Please help. Below are some code snippets: Creation of surface
LPDIRECT3DSURFACE9 Surface;
if ( FAILED(d3dDevice->CreateOffscreenPlainSurface(800, 800, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &Surface, NULL))
{
   return E_FAIL;
}
D3DCOLOR Color1 = 0xFF00FF;
d3dDevice->ColorFill(Surface,NULL,Color1);
Presenting the surface
LPDIRECT3DSURFACE9 pBackBuffer=NULL;
d3dDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
d3dDevice->BeginScene() ;		{
d3dDevice->UpdateSurface(Surface,NULL,pBackBuffer,NULL);
d3dDevice->EndScene();
d3dDevice->Present( NULL, NULL, NULL, NULL );

Thank You.

Share this post


Link to post
Share on other sites
Hi,

For ColorFill to work, the surface has to be in D3DPOOL_DEFAULT, but for UpdateSurface, the source surface must be in D3DPOOL_SYSTEMMEMORY. The D3D debug runtime (and the docs of course) will give hints when these things happen.

Regards,
Andre

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