Jump to content
  • Advertisement
Sign in to follow this  
chadmv

D3DXCreateFont fails in release mode but not in debug

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

When I reset my device and recreate my font in debug mode everything is fine, but when I run in release mode, my message box comes up saying that D3DXCreateFont failed. Everything runs fine though after that. Any one know why or have any suggestions? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Look for uninitialised variables. Things that run in debug and not in release are often due to this as in debug mode uninitialised vars are filled with debug values.

Share this post


Link to post
Share on other sites
I'm getting an Invalid Data error. Would it have anything to do with me not using the ID3DXFont::OnLostDevice and OnReset methods? I tried it with the calls but still not luck.

void CGame::SetupFont() {
HRESULT hr = D3DXCreateFont( m_pD3DDevice,
21, 0,
0,
1,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,
"Arial",
&m_pFont );
}

// clip..

if ( m_bIsLost )
{
if ( m_pD3DDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET )
{
Reset();
m_bIsLost = false;
}
else
{
return( S_OK );
}
}


// clip..

if ( FAILED( m_pD3DDevice->Present( 0, 0, 0, 0 ) ) )
{
m_bIsLost = true;
m_pFont->OnLostDevice();
}

// clip..

HRESULT CGame::Reset()
{
SAFE_RELEASE( m_pFont );

// Rebuild the presentation parameters
BuildPresentParameters();

m_pD3DDevice->Reset( &m_D3Dpp );

m_pFont->OnResetDevice();
SetupFont();

// Reinitialize the render states for DirectX Graphics
SetupRenderSettings();

return( S_OK );
} // End Reset






*EDIT*
I think I figured it out. I don't need to SAFE_RELEASE ID3DXFont and I also don't need to recreate the font a 2nd time. Simply calling OnLostDevice and OnReset seem to do the trick. And btw, I visit your site a lot!

[Edited by - chadmv on September 28, 2004 8:47:10 PM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!