Sign in to follow this  
Sparhawk42

Problem with CDXUTTextHelper and Window-Maximize [Solved]

Recommended Posts

Sparhawk42    138
I get always the following Message, if I want to maximize my window (with Direct3D Debugmode on): Direct3D9: (ERROR) :All user created stateblocks must be freed before Reset can succeed. Reset Fails. This the code (boiled done, who causes this):
class NoStateFound
	: public GraphicState
{
	  public:
			NoStateFound( int stateId, GraphicEngine* graphEng ): GraphicState( stateId, graphEng )
			{};

			virtual void onFrameRender( double fTime, float fElapsedTime )
			{
				graphEng_->clear( 0, 0, 50 );

				if( graphEng_->beginScene() )
				{

					graphEng_->beginText( FONT_ARIAL_BOLD_04 );
	
					graphEng_->endText();

					graphEng_->endScene();
				}

			}

};




With GraphicEngine functions as follows:
void 
GraphicEngineDirect3d::beginText( int fontId )
{
	if( txtHelper_ ) 
	{
		delete txtHelper_;
	}
	txtHelper_ = new CDXUTTextHelper( getD3DFont( fontId ), textSprite_, 0 );
	txtHelper_->Begin();
}

void GraphicEngineDirect3d::endText()
{
	if( txtHelper_ )
	{
		txtHelper_->End();
		delete txtHelper_;
		txtHelper_ = NULL;
	}
}




and
CDXUTTextHelper* txtHelper_

The above is caused by beginText endText Block in NoStateFound. So what must I do with txtHelper_, when my window is maximized... an explicit call to raphicEngineDirect3d::endText() didn't fix the problem. Thanks for your help. [Edited by - Sparhawk42 on August 7, 2005 7:02:03 AM]

Share this post


Link to post
Share on other sites
Sparhawk42    138
I would really appreciate some help on this topic.

By the way the window maximize case is just the easiest to reproduce case for me, this problem happens also, when toggling fullscreen/window or changing Screenresolution in full screen.

Share this post


Link to post
Share on other sites
Sparhawk42    138
I really are stuck with this buck, so maybe someone has any Idea...

here is some more code to maybe clarify the situation:



void CDXUTTextHelper::Begin()
{
if( m_pSprite )
m_pSprite->Begin( D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE );
}
void CDXUTTextHelper::End()
{
if( m_pSprite )
m_pSprite->End();
}




ID3DXSprite* m_pSprite;


Share this post


Link to post
Share on other sites
Sparhawk42    138
I've fixed this one now on my own. I had just to add two missing Callbacks on OnReset and onLostDevice, and to forward the calls to all fonts and the textSprite_

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this