surface to surface copy

Started by
1 comment, last by DrunkenHyena 18 years, 8 months ago
before i call the following: pTexture->GetSurfaceLevel(...); pDevice->UpdateSurface(pSurface,...); pSurface2->Release(); //begin scene, begin, blah, blah pDevice->Draw(...); //end, end scene, present, blah, blah i need to run my bitmap blitting routine (which is actually a font engine) and update pSurface. what is the correct method to do this? my source surface containing my font bitmap is called pFontSurface. testing wiht a single call such as the following is failing with a D3DERR_INVALIDCALL: RECT rc={0,0,50,12}; PONT pt={50,50}; pDevice->UpdateSurface(pFontSurface,&rc,pSurface,&pt); should i even be using UpdateSurface for this process or do i need to lock pSurface first and then access the memory directly (ughh...)? thanks in advance for your help/suggestions! note: D3DXLoadSurfaceFromSurface seems to work for me, but will several calls to this, blitting each letter cause performance problems? - also, it doesn't seem to support transparency!!! are there still better methods of accomplishing this? [Edited by - fluke on August 17, 2005 2:10:32 AM]
Advertisement
When you get the D3DERR_INVALIDCALL error, what does the debug spew say? Whenever a DirectX call fails, the particular reason why it failed will be printed to the debug spew. This will help you figure out exactly what's wrong so you know where to concentrate your efforts to fix it.

If you're not sure what the debug spew is, check the forum FAQ for details on how to set it up.

neneboricua
It's really not a good idea to implement a font engine like that. It reminds me of the system used in that Zen of D3D book. As you noticed, it will not support transparency (or a lot of other things) and performance is horrible as well.

You want your font data loaded as a texture, then draw textured quads. A simple implementation can be found here.
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement