I need to save the ShadowMap screen into a texture (IDirect3DBaseTexture9 or IDirect3DTexture9) like a screenshot, so I can use the data in this texture during my ShadowedScene.
what I have done so far is not working (I get an error: Unhandled exception at 0x67638d9e in Project.exe: 0xC0000005: Access violation reading location 0x00000080.)
IDirect3DBaseTexture9* ShadowMapTex;
IDirect3DSurface9* RenderTarget;
render("ShadowMap");
Device->GetRenderTarget(0, &RenderTarget);
ShadowMapTex = (IDirect3DBaseTexture9*)RenderTarget;
lightingFX.fx->SetTexture("xShadowMap", ShadowMapTex);
Device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0L);
render("ShadowedScene");
[/quote]