Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

WinFX/WPF performance for CAD application

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 06-08-2006   #1 (permalink)
John Dunn
Guest


 

WinFX/WPF performance for CAD application

Hello-

I am trying to understand all of this new fangled WinFX stuff and determine
if it's appropriate for our next generation application. Our application is
basically a schematic/CAD/graphics program where the user can place objects
on the screen and then 'wire' ( kind of like Visio ) the objects together. An
object can be 'opened' and more objects can be created inside of the parent.
An opened object creates a new child window that is the objects 'canvas'. On
screen we may be drawing 100s of objects but the entire project file might
contain 1000s of objects - some might be either scrolled off screen or
contained within other objects so they aren't currently visible.

In the past we've used straight Win32/GDI+ for our windows and drawing.
Unfortunately GDI+ never made it to hardware acceleration AFAIK and the
performance wasn't ever that great. We did like some of the features -
anti-aliasing, support for numerous graphics formats, gradients, etc but the
speed of the GUI was never snappy enough using GDI+

After reading about WinFX/WPF for a couple of days it doesn't look like
there's a new hardware accelerated drawing API that could be seen as a drop
in replacement for GDI+. It appears as though you can host a avalon window
inside of a WIN32 HWND but it doesn't look like a OnPaint method is exposed -
I'm guessing that the expectation is that you load the objects into the
canvas and let WPF do the drawing for you. Is that correct?

Is WinFX/WPF suitable for a CAD application with possibly 100s ( maybe 1000s
) of objects on screen at once? All the examples show a couple of buttons and
a few bouncing balls - nothing that cutting edge. Would I be better served
using DirectX to do my drawing? All I'm really looking for is a hardware
accelerated 2d graphics library.

The other issue is C++. We've been a C++ shop for 14+ years so moving to C#
will be quite a big undertaking. It looks like MS sees C#/XAML as the future
but in the past they've been know to shift there focus. C++/Win32 is
basically guaranteed to always be supported.

Thanks for any help-

John

My System SpecsSystem Spec
Old 06-08-2006   #2 (permalink)
Nick Kramer [MSFT]
Guest


 

Re: WinFX/WPF performance for CAD application

We think that for most new programs, managed code is the right answer, and
we think over time it will be appropriate for more and more programs. That
said, there's a lot of existing unmanaged code, and unmanaged is still the
right answer for some problem domains, so we don't intend to drop support
for our existing unmanaged APIs anytime soon.

WPF 1.0 was not targeted and tuned for 3D CAD applications, so I can't
honestly recommend it for 3D CAD. For 2D applications, it may or may not
have the performance you need, you'll want to do some prototyping. Bear in
mind that there are multiple abstraction layers you can write to in WPF,
with different performance/ease-of-use trade-offs. Pablo's blog has a
couple relevant articles:
http://www.fernicola.org/loquitor/in...straction.html
and
http://www.fernicola.org/loquitor/in...hnologies.html.

DirectX doesn't really have 2D drawing APIs as GDI and GDI+ people have come
to think of them. You can theoretically build them on top of Direct 3D, by
tessolating drawing commands into meshes of triangles, which is what WPF has
done, but it's a ton of work. Then again, are you sure you need hardware
accelerated 2D? GDI is hardware accelerated on Windows XP but not on
Windows Vista, but we haven't seen a lot of real world applications that
this made a noticeable difference. Not that it's impossible, it definitely
happens especially when using things like gradients, just that rendering
isn't always where the performance bottleneck is in applications. If you're
using GDI today, you might want to try out Windows Vista and see if if
that's the bottleneck for you.

-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"John Dunn" <John Dunn@discussions.microsoft.com> wrote in message
news:A8E3A5C0-2157-43A1-8322-4ECB87DE4756@microsoft.com...
> Hello-
>
> I am trying to understand all of this new fangled WinFX stuff and
> determine
> if it's appropriate for our next generation application. Our application
> is
> basically a schematic/CAD/graphics program where the user can place
> objects
> on the screen and then 'wire' ( kind of like Visio ) the objects together.
> An
> object can be 'opened' and more objects can be created inside of the
> parent.
> An opened object creates a new child window that is the objects 'canvas'.
> On
> screen we may be drawing 100s of objects but the entire project file might
> contain 1000s of objects - some might be either scrolled off screen or
> contained within other objects so they aren't currently visible.
>
> In the past we've used straight Win32/GDI+ for our windows and drawing.
> Unfortunately GDI+ never made it to hardware acceleration AFAIK and the
> performance wasn't ever that great. We did like some of the features -
> anti-aliasing, support for numerous graphics formats, gradients, etc but
> the
> speed of the GUI was never snappy enough using GDI+
>
> After reading about WinFX/WPF for a couple of days it doesn't look like
> there's a new hardware accelerated drawing API that could be seen as a
> drop
> in replacement for GDI+. It appears as though you can host a avalon window
> inside of a WIN32 HWND but it doesn't look like a OnPaint method is
> exposed -
> I'm guessing that the expectation is that you load the objects into the
> canvas and let WPF do the drawing for you. Is that correct?
>
> Is WinFX/WPF suitable for a CAD application with possibly 100s ( maybe
> 1000s
> ) of objects on screen at once? All the examples show a couple of buttons
> and
> a few bouncing balls - nothing that cutting edge. Would I be better served
> using DirectX to do my drawing? All I'm really looking for is a hardware
> accelerated 2d graphics library.
>
> The other issue is C++. We've been a C++ shop for 14+ years so moving to
> C#
> will be quite a big undertaking. It looks like MS sees C#/XAML as the
> future
> but in the past they've been know to shift there focus. C++/Win32 is
> basically guaranteed to always be supported.
>
> Thanks for any help-
>
> John



My System SpecsSystem Spec
Old 06-09-2006   #3 (permalink)
John Dunn
Guest


 

Re: WinFX/WPF performance for CAD application

"Nick Kramer [MSFT]" wrote:

> WPF 1.0 was not targeted and tuned for 3D CAD applications, so I can't
> honestly recommend it for 3D CAD. For 2D applications, it may or may not
> have the performance you need, you'll want to do some prototyping. Bear in
> mind that there are multiple abstraction layers you can write to in WPF,
> with different performance/ease-of-use trade-offs. Pablo's blog has a
> couple relevant articles:
> http://www.fernicola.org/loquitor/in...straction.html
> and
> http://www.fernicola.org/loquitor/in...hnologies.html.


Thank you. Both of these entries look helpful.

> DirectX doesn't really have 2D drawing APIs as GDI and GDI+ people have come
> to think of them. You can theoretically build them on top of Direct 3D, by
> tessolating drawing commands into meshes of triangles, which is what WPF has
> done, but it's a ton of work. Then again, are you sure you need hardware
> accelerated 2D? GDI is hardware accelerated on Windows XP but not on
> Windows Vista, but we haven't seen a lot of real world applications that
> this made a noticeable difference. Not that it's impossible, it definitely
> happens especially when using things like gradients, just that rendering
> isn't always where the performance bottleneck is in applications. If you're
> using GDI today, you might want to try out Windows Vista and see if if
> that's the bottleneck for you.


The problem is that since we use a lot of bezier curves in our drawing we
really need anti-aliasing. In a quick test a pure GDI app can draw ~20,000
elipses per second. Using GDI+ with antialiasing I get about 500.
Unfortunatly GDI doesn't have the features we desire. I'm a little concerned
about your comment about GDI not being accelerated on Vista. Does that mean
that to get good performance it will be required to use WPF or write our own
DirectX graphics library ( which you said would be quite difficult )? It's
unfortunate that Microsoft chose to not expose the low level drawing API.
I'll look into using the Visual level and see what type of performance I can
get. Is there any example of using the Visual classes from C++ being hosting
inside of a Win32 HWND?

Thanks-

John
My System SpecsSystem Spec
Old 06-09-2006   #4 (permalink)
Feng Yuan [MSFT]
Guest


 

Re: WinFX/WPF performance for CAD application

WPF is suitable for a CAD application with possibly 1000s objects at once
normally, unless you use lots of expensive stuff.

--
Feng Yuan [MSFT] http://blogs.msdn.com/fyuan

> Is WinFX/WPF suitable for a CAD application with possibly 100s ( maybe
> 1000s
> ) of objects on screen at once? All the examples show a couple of buttons
> and
> a few bouncing balls - nothing that cutting edge. Would I be better served
> using DirectX to do my drawing? All I'm really looking for is a hardware
> accelerated 2d graphics library.



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use WinFX (FlowDocumentReader etc.) in non-GUI application? P Chase Avalon 0 03-07-2008 03:11 AM
appdata-local-Application Data-Application Data-Application Data infinitum ad nauseum. WHY keepout Vista General 15 09-15-2007 07:50 PM
Developing WinFX application under Windows XP Install Requirements Mircea Cimpoi Avalon 0 10-15-2006 05:03 PM
WPF 3D Performance in WinFX Beta 2 Mike Strobel Avalon 1 06-02-2006 03:32 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51