Getting started with the Managed3D API.

This tutorial describes the basics needed to get your project up and running using Managed3D.

Part 1: References and Prerequisites

Managed3D has several components. The main library is contained in Managed3D.dll and has everything you need to get started using the reference software renderer. Additionally, if you plan on using DirectX, you will need Managed3D.Rendering.Direct3D.dll, or Managed3D.Rendering.OpenGL.dll if you intend to use OpenGL instead.

The main library has no dependencies, whereas the DirectX and OpenGL renderer implementations depend on some native binaries.

Add references to these libraries in the project you are working on.

Part 2: The Renderer

Before you can show some polygons on your screen you need to set up a Renderer and initialize it. We also need to create a render target for the renderer to send frames to. We'll use the built-in WinForms-based render target:
using System;
using Managed3D.Geometry;
using Managed3D.Rendering;
using Managed3D.Rendering.Software;

public static class Program
    public static void Main()
        var renderer = new SoftwareRenderer();
        var target = new ManagedRendererHostForm(renderer);
        renderer.BackgroundColor = new Vector4f(0.11764705882f, 0.11764705882f, 0.11764705882f, 1.0f);

Normally, once the renderer is created, you can start it like so:

However, because we are using the ManagedRendererHostForm target, we start the rendering process differently:

You should end up with a window and a blank grey background. Neat, but not very useful. To actually see results you'll need to build a scene and assign the scene to the renderer so that it knows what to display.

First, add the required using directives to your source file:
using Managed3D.Geometry.Primitives;
using Managed3D.SceneGraph;

Next, we'll generate a simple scene, and put this before we actually start the renderer:
        var scene = new Scene();
        scene.Root = new Node(new Cube(75.0));
        renderer.Scene = scene;

Once you build and run your project, you should see something like this:


Last edited Dec 26, 2012 at 5:34 PM by cathode, version 5


No comments yet.