Archived

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

D3DX Font with programmable shaders

This topic is 5535 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

I have a simple FPS counter in my engine which uses D3DXFONT to render the text on screen. This normally works fine, however when I enable programable shaders (eg render a model with a vertex/pixel shader combination written by me), the text doesn''t appear any more.. The model renders fine with the new shader, so I''m guessing that maybe the D3DX Font DrawText() method doesn''t set the correct FVF shader? (I would have assumed it would though..?) If this is the case, does anyone know how I can set up the vertex and pixel shader so that it can correctly render D3DX text again after using programmable shaders? [ If I set the vertex and pixel shader to NULL, the text actually renders correctly now, but the DX debug runtime spits out hundreds of C++ exceptions, claiming that 0x0 is an invalid shader handle ].. Any ideas on how to get the text rendering after enabling programmable shaders?

Share this post


Link to post
Share on other sites
My guess is it _does_ set the FVF. However what it probably doesn''t set is the pixel shader.

Try setting just the pixel shader to NULL when you come to render the D3DX stuff **AND** set up some valid TextureStageStates to specify what you want to replace the pixel shader with!.

On top of that, ensure you have a valid projection matrix and viewport, and that none of the "legacy" states such as D3DRS_LIGHTING are set to values you wouldn''t expect.

It''s entirely possible that a buggy driver may trash the legacy render states if you''ve been using shaders.

At program start time, always set ALL render states to _known_ values, even if you only ever use shaders!.

If you do that, you can also put in special "paranoia" code for debugging to Get the current states to check whether unsetting the pixel shader has trashed something.

Another thing, are you using a PURE device by any chance ?

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites