Archived

This topic is now archived and is closed to further replies.

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

This topic is 5184 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites