Jump to content

  • Log In with Google      Sign In   
  • Create Account

FW1FontWrapper kills fps


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 noatom   Members   -  Reputation: 782

Like
0Likes
Like

Posted 07 October 2012 - 09:22 AM

So I decided to use FW1FontWrapper for showing some text in my small game.

The function:

[source lang="cpp"]void drawText(ID3D11Device *pDevice, ID3D11DeviceContext *pContext) { IFW1Factory *pFW1Factory; HRESULT hResult = FW1CreateFactory(FW1_VERSION, &pFW1Factory); IFW1FontWrapper *pFontWrapper; hResult = pFW1Factory->CreateFontWrapper(pDevice, L"Arial", &pFontWrapper); pFontWrapper->DrawString( pContext, L"Text",// String 12.0f,// Font size 100.0f,// X position 50.0f,// Y position 0xff0099ff,// Text color, 0xAaBbGgRr 0// Flags ); pFontWrapper->Release(); pFW1Factory->Release();}[/source]


That function gets called every time a frame is being draw!

My game usually runs at 300+ fps,with that function being called every time a frame is being draw it gets down to 3-4FPS!

Any solution?

Sponsor:

#2 kunos   Crossbones+   -  Reputation: 2207

Like
1Likes
Like

Posted 07 October 2012 - 09:57 AM

very easy.. do not create the wrapper in every call, just create when the application starts and get rid of it when you close it.

You are not creating a DX device at every frame arent you? Why would you do that with the font wrapper?
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#3 noatom   Members   -  Reputation: 782

Like
0Likes
Like

Posted 07 October 2012 - 10:02 AM

damn...that was a very dumb question wasn't it? Anyway,works,thx Posted Image 300 fps are normal...

Edited by noatom, 07 October 2012 - 10:02 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS