Del via


Direct2D Sample Videos

ChartDemo.wmv -- Although D2D can render thousands (the exact amount depends on the video hardware that's used, quality of drivers, amount of memory, etc) of anti-aliased primitives per second, there are some cases where even greater performance is required. ChartDemo demonstrates an alternative approach that uses aliased lines and rectangles (primitives that have been highly optimized in D2D) along with MSAA rendering (via D3D interop). With this approach, ChartDemo is able to scale much further.

 

Chomp.wmv -- This demo started out as a simple 2D Pac Man-like game and, gradually, we kept adding features; for example, zooming, god-mode and, unlike the original Pac Man game, our variation maps the playfield onto the outside faces of a cube, and rotates the cube to the closest contiguous face as the Chomp character runs through the tunnels. One other important note is that the playfield is rendered entirely using anti-aliased vector primitives -- not bitmaps -- so features such as zooming can be accomplished without scaling artifacts.

 

SciFiText.wmv -- This sample combines Direct2D and Direct3D to achieve what is commonly known as the "scrolling Star Wars text effect". An application can render Direct2D content into a Direct3D surface, and then display that surface at an angle to the camera.

SimplePathAnimation.wmv -- This sample demonstrates how to use a Direct2D Path Geometry to drive a path animation. Every D2D geometry exposes a ID2D1Geometry::ComputePointAtLength method, which can be used to obtain a point and tangent vector for any given length.

 

TextExtrusion.wmv -- This sample illustrates how DirectWrite, Direct2D, and Direct3D can be combined to create a text-extrusion effect. Text geometry is generated using a custom IDWriteTextRenderer that calls into IDWriteFontFace::GetGlyphRunOutline. D2D geometry operations are then used to eliminate self-intersections and tessellate the front and back faces. Side faces are generated by walking the text geometry and emitting quads. DWrite hit-testing is also used for positioning of the cursor. Finally, the generated triangles are sent to D3D for rasterization.

 


Demos.zip

Comments

  • Anonymous
    January 01, 2003
    @PeterG:
    Is Direct2D also useful if the application render target is the system memory (from gdi:createDIBSection)? Can Direct2D directly render to system memory or will it automatically read back from video memory? Direct2D can render directly to system memory. We understand that this scenario is important to many developers.

  • Anonymous
    January 01, 2003
    @anonymous:
    If Direct2D is part of DirectX and DirectX 11 is going to be available on Vista, does this men Direct2D will be available on Vista as well?  Yes, we announced at PDC that Direct2D will be available on Vista.

  • Anonymous
    January 01, 2003
    I really like the concept of path animation. I believe it's going to result in many creative ideas for applications, games, and data visualization. I'm also glad you've included the tangent vector. Thank you, I agree. The rich geometry API in Direct2D will make it easier for developers to create some really interesting applications. On a related note, Windows 7 will include a cool new animation API that you can preview at the very end of the PDC session video for Direct2D and DWrite. It's definitely worth checking out.
    http://channel9.msdn.com/pdc2008/PC18/
     As just a normal programmer, not a MVP or subscribing to any developer programs (MSDN), what's the best route I can follow to get these bits early? I'm quite eager to test D2D out. A lot of people have asked that same question. I've asked my management for more information, and I will let you know as soon as possible. Meanwhile, if you like, send me an email (via the link to above right), and I will put you in touch with our program manager for developer engagements.

  • Anonymous
    January 01, 2003
    @sysrpl:  ".. I am guessing we can forego the vertex shader .." Correct.

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    November 16, 2008
    Tom, I really like the concept of path animation. I believe it's going to result in many creative ideas for applications, games, and data visualization. I'm also glad you've included the tangent vector. As just a normal programmer, not a MVP or subscribing to any developer programs (MSDN), what's the best route I can follow to get these bits early? I'm quite eager to test D2D out.

  • Anonymous
    November 18, 2008
    The comment has been removed

  • Anonymous
    November 25, 2008
    Tom, Ah okay, I haven't done too much (or anything at all) with HLSL, which I assume is what language we will need to use to blend pixels together. I have used other shading languages. I am guessing we can forego the fragment vertext shader, and just provide our own custom pixel/fragment shader. Hrm, but if you provide our own fragment shader, wouldn't that eliminate antialiasing? Also, I had another question regarding paths. Will Direct2D include a feature to allow us to expand and contract paths? You know, something like offsetting a path along the tangent vector using an arbitrary distance (could be positive or negative)?

  • Anonymous
    November 26, 2008
    Correction from above: ".. I am guessing we can forego the vertex shader .."

  • Anonymous
    November 28, 2008
    Is Direct2D also useful if the application render target is the system memory (from gdi:createDIBSection)? Can Direct2D directly render to system memory or will it automatically read back from video memory? Please note that system memory is very useful for many application developers (optimal pixel access in any language).

  • Anonymous
    November 28, 2008
    @sysrpl: Geometry expansion/contraction can be achieved by Widen()ing the geometry and then Combine()ing the result with the original geometry with either D2D1_COMBINE_MODE_UNION or D2D1_COMBINE_MODE_EXCLUDE, respectively.

  • Anonymous
    December 30, 2008
    Direct2D and DirectWrite look amazing.  I cannot wait to play around with these APIs.  The most exciting aspect to me is the Direct3D interop; the possibilities really are endless!

  • Anonymous
    January 02, 2009
    If Direct2D is part of DirectX and DirectX 11 is going to be available on Vista, does this men Direct2D will be available on Vista as well?

  • Anonymous
    November 19, 2009
    I know this post is nearly a year old but hopefully I'll still get a response.  Is the source available for these examples?  It would be nice to have a look at how these examples were put together.

  • Anonymous
    February 04, 2010
    I'm sure you've found by now, but the available samples are here: http://msdn.microsoft.com/en-us/library/dd368187%28VS.85%29.aspx Also, see the Win7 SDK Microsoft SDKsWindowsv7.0SamplesmultimediaDirect2D and ..DirectWrite folders

  • Anonymous
    July 08, 2010
    I did not see these demos in latest SDK...