I have an idea, but will It slow my cpu down?

Started by
5 comments, last by Programmer16 20 years, 6 months ago
Ok this idea is for my font engine. My idea is to have a surface named g_pFontSurface. When I''m ready I do the math and copy the correct letters to a temporary surface, named pTempFont. Then I save that surface to a bmp file named Speech.bmp and finally I load that to my texture and paint the texture to my message box. My question is will this slow a computer down really bad?
Advertisement
The file saving is very slow. Why don''t you copy the data directly from your font surface to your texture?

Please ask for more info as needed.

-Nik

Niko Suni

Ok, how would I go about copying from a surface to a texture? I''m using DirectX 8. I, of course, use the IDirect3DSurface8 and IDirect3DTexture8 objects. I have a CSurface class that I made, and I am going to make a CTexture class once I get this figured out.

PS: Thanks for replying
This might help, have your font image as src, and just create a nxn texture called dst. You can extract the surface using get surface, and then use update surface to copy individual letters as needed.

This is DX9, I belive DX8 uses CopyRect instead of UpdateSurface, but it's pretty much the same. Hope this helps.

IDirect3DSurface9 *srcSurface;IDirect3DSurface9 *dstSurface;textures[srcTexture]->GetSurfaceLevel(0,&srcSurface);textures[dstTexture]->GetSurfaceLevel(0,&dstSurface);hr =  m_pd3dDevice->UpdateSurface(srcSurface,srcRect,dstSurface,dst); 


[edited by - ataru on October 9, 2003 11:43:44 AM]
D3DXLoadSurfaceFromSurface works better with sys->sys copies.

-Nik

Niko Suni

Better in what way? Is it faster, or is it simply more robust?
More robust, and UpdateTexture doesn''t work on either of my machines on sys->sys copies, but LoadSurf...() does.
I have GFFX5900 and GF2MX400, if that''s relevant.
Besides, the function is optimized to do direct scanline copies if the src and dest are of same format.

Kind rgds,
Nik

Niko Suni

This topic is closed to new replies.

Advertisement