Skip to main content
gamedev.net
🔒 Locked

Error DX9

Started by Prog101 Aug 6, 2007 at 8:49 AM 3 replies 900+ views
Original Post
Prog101
Prog101
my code will not enter this if statement for some reason if (SUCCEEDED (IDirect3DDevice9_UpdateSurface( pDirect3DDevice, lpD3DRenderTarget , NULL, lpD3DTempSurface,NULL))) { }

	LPDIRECT3DSURFACE9	lpD3DRenderTarget = NULL;
	LPDIRECT3DSURFACE9	lpD3DTempSurface = NULL;
	D3DLOCKED_RECT		d3dLockedRect;
	D3DSURFACE_DESC		d3dDesc;
	LPDIRECT3DSURFACE9 lpD3DFrontBuffer = NULL;

IDirect3DDevice9_GetRenderTarget( pDirect3DDevice, 0, &lpD3DRenderTarget );

if (SUCCEEDED( IDirect3DSurface9_GetDesc( lpD3DRenderTarget, &d3dDesc )))
{
IDirect3DDevice9_CreateOffscreenPlainSurface( pDirect3DDevice, d3dDesc.Width, d3dDesc.Height,D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &lpD3DTempSurface, NULL);

    if (SUCCEEDED (IDirect3DDevice9_UpdateSurface( pDirect3DDevice, lpD3DRenderTarget , NULL, lpD3DTempSurface,NULL)))
    {
    }
}


Evil Steve
Evil Steve
Install the debug runtimes and read the Documentation, and you'll find out that:
Quote:
This function has the following restrictions.
  • The source surface must have been created with D3DPOOL_SYSTEMMEM.
  • The destination surface must have been created with D3DPOOL_DEFAULT.


  • You probably want StretchRect, and you'll want the temp surface in D3DPOOL_DEFAULT.
    Prog101
    Prog101
    when i do
    IDirect3DDevice9_GetRenderTarget( pDirect3DDevice, 0, &lpD3DRenderTarget );if (SUCCEEDED( IDirect3DSurface9_GetDesc( lpD3DRenderTarget, &d3dDesc ))){IDirect3DDevice9_CreateOffscreenPlainSurface( pDirect3DDevice, d3dDesc.Width, d3dDesc.Height,D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpD3DTempSurface, NULL);   if (SUCCEEDED (IDirect3DDevice9_StretchRect(pDirect3DDevice,lpD3DRenderTarget,NULL,lpD3DTempSurface,NULL,0)))    {    }}


    i get the same , not going into the

    if (SUCCEEDED (IDirect3DDevice9_StretchRect(pDirect3DDevice,lpD3DRenderTarget,NULL,lpD3DTempSurface,NULL,0)))
    {
    }


    if statement
    Evil Steve
    Evil Steve
    Quote:
    Original post by Evil Steve
    Install the debug runtimes
    That'll give you useful debug output, telling you what's wrong. Also, what is the return value? Checking with SUCCEEDED narrows it down to one of 2 billion (Well, 2,147,483,647) possible error codes...

    Topic Locked

    This topic has been locked by a moderator. New replies are not allowed.

    Sign in to reply to this topic.