Jump to content
  • Advertisement
Sign in to follow this  
johndirect

Present not displaying surfaces

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

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
Advertisement
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
Thanks EviSteve and VizOne.

I see that if I use StretchRect instead of UpdateSurface, I can copy the surface onto the backbuffer.

Share this post


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