Text not being displayed

Jan 22, 2015 at 5:18 PM
I'm working on a legacy application and trying to use your code. I have a coordinate system and I'd like to label the axis, x, y, z. The legacy code says to "render the scene to a target and set the texture to D3DImage11. WPF will handle double buffering internally."

I'm new to 3D development, so I'm not entirely sure what that means. There are no errors, but the text simply isn't displayed. I did set the viewport before I initialized the SpriteRenderer. I have a feeling that may be the problem.

The function DrawScene() is similar to MessagePump. It loops once for every frame. You can see below it sets 2 viewports each frame. To get SpriteRenderer to work I initialize my device with one of these viewports much earlier in my program. Which one should I be using?
    mDevice.ImmediateContext.Rasterizer.SetViewports(new Viewport(0.0f, 0.0f, mBackBufferWidth, mBackBufferHeight, 0.0f, 1.0f));

    mDevice.ImmediateContext.ClearDepthStencilView(mDepthStencilView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
    mDevice.ImmediateContext.ClearRenderTargetView(mBackBufferRtv, new Color4(1.0f, 0.0f, 0.0f, 1.0f));

    mDevice.ImmediateContext.Rasterizer.SetViewports(new Viewport(0.0f, 0.0f, mBackBufferWidth, mBackBufferHeight));
    //Function continues. Truncated for brevity
Any help you could provide would be great. Let me know if I'm missing important info and I'll be sure to clarify.
Jan 23, 2015 at 12:12 PM
You should call the RefreshViewport method of your SpriteRenderer instance whenever your viewport dimensions change. When you look at the ConvertCoordinate method in SpriteTextRenderer/SpriteRenderer.cs, you'll see that it only uses the viewport's dimensions for calculating the absolute coordinates.
Jan 23, 2015 at 12:30 PM
Turns out I'm just not paying attention. When I initialized my viewport I passed it a variable for width & height. Those variables hadn't been set yet. OOPS. Entirely my fault, and everything works exactly as described in the example.
Marked as answer by Nico201 on 1/26/2015 at 11:08 PM