John
John

Reputation: 6268

LPD3DXFONT does not draw

I am having an issue with my LPD3DXFONT not drawing anymore.

DrawText() returns D3D_OK and was working just fine earlier.

My primitives and sprites are drawing just fine, but all of the text is no longer visible.

I believe it may have been a change from a render state, but I don't which one could cause the font to stop rendering while leaving sprites just fine.

Upvotes: 0

Views: 489

Answers (1)

Asesh
Asesh

Reputation: 3361

You should specify these flags before rendering ID3DXFonts: D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE. This code works fine here:

// Prepare the device for drawing sprites
if(SUCCEEDED(m_pD3DXSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE)))
{
    // Render the data on the screen
    m_pD3DXFont->DrawText(m_pD3DXSprite, m_szFPSData, -1, &oTextClientRect[0], 0, 0xFFFF0000); // FPS data

    // End sprite drawing operations
    m_pD3DXSprite->End();
}

Upvotes: 1

Related Questions