   Texture questions
  I'm using DirectX9 to "overlay" text and lines over a stretched image.I'm drawing the image to a surface and stretching that surface to the backbuffer.  That works great.To overlay the text and lines, I'm creating a texture of format A8R8G8B8, using some GDI code to draw the text and lines onto the texture's surface, then using a sprite to render it.This is almost working.  I'm having two problems:1) If I create the texture in the SystemMemory pool, the text and lines don't show up on the image.  If I create the texture in the default pool, they show up but it's quite a bit slower.2) I'd like to reuse the texture since it takes a while to create one and I'm only showing one image at a time, but every time I draw the new contents (text and lines) to the texture and render the sprite, the text and lines from the last pass are still there.  I tried marking the entire texture dirty between each image, but that didn't fix it.  Creating a new texture for every image fixes it but it's too slow.   
  1)Can't help you here, Ive always used something like D3DXFONT to do this rather than GDI..2)You need to clear the surface, so basicly you could lock it and loop through all the bits seting them to 0.   ;  Using GDI and D3D together is always a pain in the rear.  At the end of they day they're just two different subsystems with two very different goals, which makes it hard to use them together in an effective manner.  For anything that's performance sensitive, you'll really want to avoid GDI altogether and come up with something that uses only D3D.  Games have done this for years with their UI and font rendering, as well as with rendering of basic primitives (lines, rectangles, etc.)If you must use GDI, then apply standard practices for doing software operations in tandem with GPU hardware:-Lock as few surfaces as you can, and lock them the least often you can possibly bear.  If you can cache results, (for example, render out a few commonly used words or even individual letters and then use them later) then do so.-Do your locking and modifying as far ahead of using it as possible.  It's commonly to double or triple-buffer dynamic resources so that you're not locking a surface that the GPU is currently using.  This introduces lag, but keeps performance up.BTW ID3DXFont does use GDI in some manner, but I'm not familiar with exactly how it handles caching of the results and such.  Evil Steve looked into it a while ago...he would be the person to ask.   ;  Thanks for the tips!I'm kinda' stuck with the GDI code because it's in an existing library, but rewriting it is definitely a possibility in the future.I'm really confused about problem #1 I mentioned.  I can't see any documentation explaining why creating the texture in the system pool vs the default pool would affect the results (besides performance).  I've seen several examples of people using sprites to render textures that were created in the system pool, but when I do that they just don't render.   ;  For #1, see the documentation for IDirect3DDevice9::SetTexture: IDirect3DDevice9::SetTexture is not allowed with a pool type of D3DPOOL_SYSTEMMEM texture unless DevCaps is set with D3DDEVCAPS_TEXTURESYSTEMMEMORY. I'd suspect your problem is that this flag isn't set.  I have no idea whether it's common for hardware to have this capability, but the documentation for D3DPOOL states that SYSTEMMEM resources "typically aren't accessible by the device".