   [D3D9] Off screen render targets
  I want to render some stuff to a surface and then use that surface as a texture to render something else (eg render a scence as seen froma  TV camera to the surface, and then render that surface onto some TV screens).The way Ive come up with seems to work, however I'm not sure if its either the best or the correct way to do this.Creating the new render target:class Surface{IDirect3DSurface9 *sur;IDirect3DTexture9 *tex;Size2<unsigned> size;void create()//also used to handle lost devices without creating a new object{if(FAILED(device->CreateTexture(size.w, size.h, 1,D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,&tex, 0)))throw exception::Error(L"Failed to create new surface");tex->GetSurfaceLevel(0,&sur);}public:Surface(Size2<unsigned> size):size(size){create();}...}Setting it as the render target, I obmitted the code for getting the current target (eg backbuffer) and restoring it.void Graphics::SetRenderTarget(Surface* sur){...store the current target so it can be reset laterIDirect3DSurface9 *d3dSur = sur->GetD3DSurface();   device->SetRenderTarget(0, &d3dSur);//set the projection arcording to the new targets size etc   updateProjection(d3dSur);}Then I can render as normal accept the result is on my surface not the backbuffer, and I can use the IDirect3DTexture9* the surface came from to render the contents of the surface on the TV screens.EDIT: Also is this safe for creating surfaces that are not powers of two size, and if not is it possible to do so (or at least the same size as the backbuffer surfaces)?   
  What you have looks fine.  As for POT textures, you won't be able to create a non-POT texture at all if the device doesn't support them.  Most will support non-POT textures conditionally, which means as long as you don't need to tile the texture or generate mipmaps you'll be fine.   