Archived

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

AngryMan

Rendering to textures in DirectX 9...

Recommended Posts

I have a big problem. I''m implementing texture based font engine, and to draw strings, it must prepare string texture by copying small pieces (characters) from bitmap font to new texture. The problem is, I don''t know how can I render from one texture to another! Could someone please help me? (I''m using D3D9)

Share this post


Link to post
Share on other sites
But I''m using D3DXSPRITE to draw font, and as far as I know, it can only draw from textures. BTW, I''m programming in D3D for few months only, and this is my first encounter with surfaces. What''s the difference between textures and surfaces?

Share this post


Link to post
Share on other sites
A texture contains one or more surfaces, depending on whether it has mipmap levels stored in it.
Level 0 surface is the texture''s first surface, you should copy the data into it.

To get the surface interface pointer (pSurf) from the texture''s first level, use IDirect3DTexture9::GetSurfaceLevel(0, &pSurf), copy the text to the said surface, and release the pSurf.





Share this post


Link to post
Share on other sites
quote:
Original post by Nik02
It''s not practical in your case; use IDirect3DTexture9::GetSurfaceLevel() instead.


Could you describe how this method works? I couldn''t get much out of SDK help...

Share this post


Link to post
Share on other sites