Jump to content
  • Advertisement
Sign in to follow this  
durilka

lame problem with textures after using ID3DXFont

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

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]

Share this post


Link to post
Share on other sites
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].

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Do all the textures become white, or doesn't it render the textures at all (displaying some "white material")?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!