NZ255

Direct2D DrawText. Attn:Colin

Recommended Posts

Hi there,

I've been following the progress with the 717 and am very impressed. I haven't bought it yet but plan to.

 

I'm trying to get into aircraft dev for a hobby and so far have a basic model and I'm now starting the gauges.

I've got shapes drawing on the display but if I try to render text it shows for a few seconds and then the whole sim crashes! Did you ever come across this problem?

I'd debug it but when I attach VS to prepar3d the breakpoint turns grey and says "Breakpoint will not be hit". 

 

Are you using VS Community 2015? Just wondering if you had to resolve these issues when you started and can point me in the right direction.

 

Any help appreciated,

Nick

Share this post


Link to post
Share on other sites
On 2/26/2017 at 0:46 AM, NZ255 said:

Hi there,

I've been following the progress with the 717 and am very impressed. I haven't bought it yet but plan to.

 

I'm trying to get into aircraft dev for a hobby and so far have a basic model and I'm now starting the gauges.

I've got shapes drawing on the display but if I try to render text it shows for a few seconds and then the whole sim crashes! Did you ever come across this problem?

I'd debug it but when I attach VS to prepar3d the breakpoint turns grey and says "Breakpoint will not be hit". 

 

Are you using VS Community 2015? Just wondering if you had to resolve these issues when you started and can point me in the right direction.

 

Any help appreciated,

Nick

Nick,

Thank you for your support! First, I'd like to suggest using 2013's runtime or lower. I've experienced VERY strange issues with 2015 on FSX Accel - similar to what you're describing (random crashing on regular function calls).

How are you drawing the text? Our DrawText calls usually look like this:

RT->DrawTextW(L"ap off", 6, pfd->pfd_txtfmt_28_center, pfd->pfd_afs_rect_center_status_ap, pfd->pfd_solidbrush_red);

If it's similar, it may be due to how the gauge surface/render targets/factories are being created. Now that I think about it, the factory may be the issue - are you using it as a shared or isolated factory? (DWRITE_FACTORY_TYPE_SHARED, etc.)

Share this post


Link to post
Share on other sites
14 hours ago, turbofandude said:

Nick,

Thank you for your support! First, I'd like to suggest using 2013's runtime or lower. I've experienced VERY strange issues with 2015 on FSX Accel - similar to what you're describing (random crashing on regular function calls).

How are you drawing the text? Our DrawText calls usually look like this:


RT->DrawTextW(L"ap off", 6, pfd->pfd_txtfmt_28_center, pfd->pfd_afs_rect_center_status_ap, pfd->pfd_solidbrush_red);

If it's similar, it may be due to how the gauge surface/render targets/factories are being created. Now that I think about it, the factory may be the issue - are you using it as a shared or isolated factory? (DWRITE_FACTORY_TYPE_SHARED, etc.)

Hey mate, I appreciate the reply :)

Yes! That's how I'm writing the text - also using a DWRITE_FACTORY_TYPE_SHARED DWrite factory.

I'm using the D2D template off fsdeveloper but that doesn't draw any text in the example. Maybe I should try VS2013.

Did you have to make the RT one of these: ID2D1DCRenderTarget

 

Nick

 

edit: just out of interest - the 6 you've given for the text length... should it be 7? To include the terminator character \0?

Edited by NZ255

Share this post


Link to post
Share on other sites

You know, on rare occasions, the text will flicker, I wonder if that's why. You'd imagine that telling it to draw 6 would mean it stops at 6, but no promises with DirectX I suppose... lol.

Regarding the RT, yes - they're all ID2D1DCRenderTargets.

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