Jump to content
  • Advertisement
Sign in to follow this  

Drawing with D3DX10Font changes draw order?

This topic is 3352 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'm writing a debug console into my DX10 2D game project. The console displays/hides when the user presses '~'. I'm using D3DX10Font's DrawTextA() function to draw the console's lines of text to the screen. The console is off by default, so its first draw occurs the first time '~' is pressed. Once the console has drawn, I'm getting unexpected changes in draw-order for the other drawn objects in the app. For instance, the following code usually draws the hero on top of a quad:
// Draw our objects
DebugConsole::Instance()->draw(); // Checks internally, only draws if console is active	

But once the debug console has drawn once, the hero is always drawn behind the quad. There are no changes to the hero's, or the quad's locations. The debug console uses the following code to draw its text:
m_pSprite->Begin( D3DX10_SPRITE_SAVE_STATE );
RECT rect = { 5, 5, 0, 0 };
D3DXCOLOR white( 1.0f, 1.0f, 1.0f, 1.0f );
m_pFont->DrawTextA( 0, m_displayInput.c_str(), m_displayInput.size(), &rect, DT_NOCLIP, white );

Why does the change in draw-order occur?

Share this post

Link to post
Share on other sites
I'm not familiar with DX10 so I may just be blowing smoke, but you might try commenting out the m_pSprite lines in the console draw function.

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!