graphics - Drawing huge amount of 2D data on .NET -
there need visualize large quantity of 2d graphic objects (draw schema of complex structure) using .net framework - example 10-20 thousand primitives on 1 canvas. assume have respective hardware - powerful server pc multi-core cpu, huge amount of ram , recent videocard. according books , msdn solution use wpf hardware acceleration, particularly drawings subsystem. i've implemented simple scenario geometrydrawings , visualhost , pretty decent, there problem - visualized objects need have changing state (i.e. change color without redrawing) , accept mouse events (click, drag'n'drop) freezables doesn't support no framework elements. ideas how solve problem efficiently? our graphical object looks alike framework-supplied shape , descendants, surely won't match performance requirements.
* edit *
graphic objects can have simple structure (red rectangle) complex (multiple nested objects contains paths - random-shaped curves). objects may overlap. layering (hide , show specific objects @ particular moment) may implemented later additional feature. state change may occur once every 2-5 seconds, triggered external event.
one word: shaders.
this looks decent tutorial on using shaders in wpf. pixel , vertex shaders pretty simple drawing primitives.
a shader let take full advantage of hardware acceleration. on decent gpu, 10k primitives nothing.
changing colors, etc. on frame-to-frame basis trivial in context.
most of shader tutorials 3d, they're applicable 2d well.
you have @ xna. doesn't natively support putting directx context inside of wpf or winforms window, there quite few tutorials on well. xna pretty powerful , takes care of lot of boilerplate code matrix manipulation, etc. you'll need. if decide not go xna, tutorials on create.msdn.com can educational.
update 10/2012
xna dead, there quite few examples out there of using shaders in wpf. if c++ skills snuff, can use d3dimage class place direct3d window on wpf form. xna samples still valuable shader content , high-level approach graphics development.
if excited xna, have @ monogame, coming along nicely. i'm using cross-platform 3d stuff (win7, osx, ios) , have no complaints.
Comments
Post a Comment