Recommended Posts

I was playing around with ID3DXFont (I''m using DX8) and found it boring, so I made my own font system that works from a bmp.
Basically it loads a bmp containing the characters and stores it on a surface. When ever I draw text it copies rects from the surface to a texture and draws a quad with the texture on it. Its pretty simple and probably not that efficient, but I can rotate, scale and multi-texture so I''m happy(er).
My problem is that the characters lose all of their color (ie they end up black) unless I perform the draw method between the ID3DXFont::Begin / End. I can''t figure out why this is because I don''t have anything in my code that references the the font interface and all my other graphics end up showing up normally.
Is there something I''m missing that is happening between the Begin/End methods?
Thanks in advance..

Share this post

Link to post

Share on other sites

I suspect that you might have problems with lighting. Try diabling lighting.

Also, why do you transfer it to a surface and then to a texture? Why not just read the whole thing directly into a texture? If you''re doing this so you can grab a rectangle then I would say you could do that simply by adjusting the UV coordinates of your quad. I think this would improve performance, but I could be wrong. I''m fairly new to all this.

Share this post

Link to post

Share on other sites

Well its not the lighting because I have disabled it or at least I think I have.

Is this all I have to do to disable it? m_pkD3DDevice->SetRenderState ( D3DRS_LIGHTING , FALSE ) ;

I''m not sure how I would implement what you''re suggesting regarding the UV coords unless I draw multiple quads (one for each character). I''m pretty new at this stuff too so maybe I''m just not understanding what you mean..

0

Share this post

Link to post

Share on other sites

I was suggesting one quad for each character but I see your point that this might not be faster. Still, you could render it all with a single call to DrawPrimitive if you stored them as a triangle strip or triangle list so I think it would still be fast. However it could be more difficult to rotate this than your way of doing it. On the other hand you could rotate each character separately and do "word art" (like bending a word, etc.) but that's probably not something that's very useful anyway.