lame problem with textures after using ID3DXFont

Started by
6 comments, last by durilka 19 years, 7 months ago
Hi. I have very strange effect. After first call to ID3DXFont::DrawText all the textures become white. Seems like some of the render states are changed(in fact they supposed to be restored), but i cannot figure out which ones. Any ideas? Thanks. [Edited by - durilka on September 13, 2004 9:46:40 AM]
Advertisement
Did you make sure to call it within ID3DXFONT::BEGIN and ID3DXFONT:END? That can cause some strange problems sometimes.

If you're positive it's a render state, you could always reset all of them, but that would be the bad way to do it [wink].
seems like in dx9 they've removed begin-end from font.
for a render states - it's a wild guess, i've tried lots of 'em. with no help. but what else can affect textures?
Do all the textures become white, or doesn't it render the textures at all (displaying some "white material")?
Quote:Original post by WanMaster
Do all the textures become white, or doesn't it render the textures at all (displaying some "white material")?


only some...
the output really differs depending on flags i use for ID3DXSprite::Begin (msdn says if you don't use it - they will use internal, so i prefer mine. anyway, without my sprite there's no difference).
Here are the screenshots. Textured are:
landscape, sky, playfield and ball.
with font landscape and ball get "whited".

normal
with font
with font and NOMODIFY
with font & NOSAVE
Mmmh, it's kinda hard to tell...

Have you tried with directx-debugging set to maximum output? That way you get some info about changes in render states. And you could try to see if a texture is actually loaded (with something like device->gettexture).

I don't have a single clear answer for you.
what i've found meanwhile is, that texture is not getting white. it just gets brighter, so ones close to white become it.

and the problem seems to be that i'm using DXMesh and my own mesh at the same time for different tasks.

anyway, i'm not going to give up.
ok. i've found smth but it's weird. maybe someone will find it useful or someone will find an explanation...
here's the code that helps me:

// normal call to draw text
m_pSprite->Begin(...);
m_pFont->DrawText(...)
m_pSprite->End()

//patch
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG0, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_CURRENT );

m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG0, D3DTA_CURRENT );

stupid. isn't it? looks like they yes restore states, but only setting 'em to something useless and back does the trick.

This topic is closed to new replies.

Advertisement