Tuesday, 15 March 2011

c# - How to create Managed DirectX Sprite that matches behavior of passing null to Microsoft.DirectX.Direct3D.Font.DrawText() -



c# - How to create Managed DirectX Sprite that matches behavior of passing null to Microsoft.DirectX.Direct3D.Font.DrawText() -

i attempting improve directx performance of tested working application. using profile tool, have pinpointed phone call microsoft.directx.direct3d.font.drawtext(sprite sprite, string text, int x, int y, int color) null passed sprite parameter responsible approximately 30% of application's cpu usage. when create sprite , pass calls of drawtext cpu usage close eliminated. problem font gets little , rotated in way isn't legible.

can create sprite render text in same way passing null microsoft.directx.direct3d.font.drawtext(sprite sprite, string text, int x, int y, int color) does? know there ways utilize 2d text instead of have prefer avoid making big changes working app.

you should place draw calls between sprite.begin() , sprite.end(). begin() phone call apply appropriate render states (e.g. transformations) , end() phone call restores previous state. of course, should not draw other sprites within block.

c# directx-9

No comments:

Post a Comment