Rendering to textures in DirectX 9...

Started by
6 comments, last by AngryMan 20 years, 6 months ago
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)
Advertisement
D3DXLoadSurfaceFromSurface()

Niko Suni

Well, in that case - can I convert surface to texture?
It''s not practical in your case; use IDirect3DTexture9::GetSurfaceLevel() instead.

Niko Suni

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?
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.




Niko Suni

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...
OK, thanx!!! You saved my life today

This topic is closed to new replies.

Advertisement