C# Can';在C中使用Axiom3D将纹理模型渲染到picturebox#

C# Can';在C中使用Axiom3D将纹理模型渲染到picturebox#,c#,3d,C#,3d,正在尝试渲染到picturebox,如示例所示: 当我只进入媒体文件夹.mesh文件时,一切正常,我看到模型,但带有PUT textxures(应该是这样)。但是当我添加*.material文件和相应的图像文件(列在*.material文件中)时,我得到了一个错误: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ******

正在尝试渲染到picturebox,如示例所示:

当我只进入媒体文件夹.mesh文件时,一切正常,我看到模型,但带有PUT textxures(应该是这样)。但是当我添加*.material文件和相应的图像文件(列在*.material文件中)时,我得到了一个错误:

See the end of this message for details on invoking just-in-time (JIT) 
debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Axiom.Core.Entity.NotifyCurrentCamera(Camera camera)
   at Axiom.Core.SceneNode.FindVisibleObjects(Camera camera, RenderQueue queue, Boolean     includeChildren, Boolean displayNodes, Boolean onlyShadowCasters)
   at Axiom.Core.SceneNode.FindVisibleObjects(Camera camera, RenderQueue queue, Boolean     includeChildren, Boolean displayNodes, Boolean onlyShadowCasters)
   at Axiom.Core.SceneManager.FindVisibleObjects(Camera camera, Boolean onlyShadowCasters)
   at Axiom.Core.SceneManager.RenderScene(Camera camera, Viewport viewport, Boolean showOverlays)
   at Axiom.Graphics.RenderTarget.Update(Boolean swapBuffers)
   at Axiom.RenderSystems.DirectX9.D3DRenderWindow.Update(Boolean swapBuffers)
   at Axiom.Graphics.RenderSystem.UpdateAllRenderTargets(Boolean swapBuffers)
   at Axiom.Core.Root.UpdateAllRenderTargets()
   at Axiom.Core.Root.RenderOneFrame()
   at WindowsFormsApplication1.Form1.timer1_Tick(Object sender, EventArgs e) in c:\Users\Vitaly    Koshura\Documents\Visual Studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 85
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    
这是我的密码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    protected Axiom.Core.Root _Root = null;
    protected Axiom.Core.SceneManager _SceneManager = null;
    Axiom.Core.SceneNode _OgreSceneNode = null;

    private void Form1_Load(object sender, EventArgs e)
    {
      timer1.Enabled = false;
      //Create root object
      _Root = new Axiom.Core.Root("Axiom.log");

      //Select the first available render system
      _Root.RenderSystem = _Root.RenderSystems[0];

      //Load resources from Media folder
      Axiom.Core.ResourceGroupManager.Instance.AddResourceLocation("Media", "Folder",     Axiom.Core.ResourceGroupManager.DefaultResourceGroupName);
      Axiom.Core.ResourceGroupManager.Instance.InitializeAllResourceGroups();

      //Initialize engine, but don't auto-create a window
      _Root.Initialize(false);

      //Manually create a RenderWindow and pass it a handle to the PictureBox control
      //to render in
      Axiom.Collections.NamedParameterList paramList = new     Axiom.Collections.NamedParameterList();
      paramList["externalWindowHandle"] = pictureBox1.Handle;
      Axiom.Graphics.RenderWindow window = _Root.CreateRenderWindow("RenderWindow",     pictureBox1.Width, pictureBox1.Height, false, paramList);

      //Create generic scene manager
      _SceneManager = _Root.CreateSceneManager(Axiom.Core.SceneType.Generic, "MainSceneManager");

      //Create a camera and initialize its position
      Axiom.Core.Camera camera = _SceneManager.CreateCamera("MainCamera");
      camera.Position = new Axiom.Math.Vector3(60, 60, 60);
      camera.LookAt(new Axiom.Math.Vector3(0, 0, 0));

      //Set camera options
      camera.Near = 5;
      camera.AutoAspectRatio = true;

      //Create viewport
      Axiom.Core.Viewport viewport = window.AddViewport(camera, 0, 0, 1.0f, 1.0f, 100);
      viewport.BackgroundColor = Axiom.Core.ColorEx.Black;

      //Set default number of mipmaps for textures
      Axiom.Core.TextureManager.Instance.DefaultMipmapCount = 5;

      //Load the ogrehead.mesh from the Media folder
      Axiom.Core.Mesh ogreMesh = Axiom.Core.MeshManager.Instance.Load("penguin.mesh",     Axiom.Core.ResourceGroupManager.DefaultResourceGroupName);

      //Create an entity and load the ogrehead.mesh into it
      Axiom.Core.Entity entity = _SceneManager.CreateEntity("OgreEntity", ogreMesh);
      //Create a scene node and attach the ogre entity
      _OgreSceneNode = _SceneManager.RootSceneNode.CreateChildSceneNode("OgreSceneNode");
      _OgreSceneNode.AttachObject(entity);

      //Start the update timer
      timer1.Enabled = true;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
            _Root.RenderOneFrame();
    }
    int prevRotation = 0;
    private void trackBar1_Scroll(object sender, EventArgs e)
    {
      //Rotate the ogre mesh
      _OgreSceneNode.Rotate(Axiom.Math.Vector3.UnitY, trackBar1.Value - prevRotation);
      prevRotation = trackBar1.Value;
    }
  }
}
它落在了底线上

_Root.RenderOneFrame();
以下是日志文件:

[03:35:55] *********Axiom 3D Engine Log *************
Copyright Copyright ? 2003-2012 Axiom Rendering Engine Project Team.
Version: 0.8.3376.12322
Operating System: Microsoft Windows NT 6.2.9200.0
.Net Framework: 4.0.30319.34014

[03:35:55] *-*-* Axiom Initializing
[03:35:55] ArchiveFactory for archive type ZipFile registered.
[03:35:55] ArchiveFactory for archive type Folder registered.
[03:35:55] Registering ResourceManager for type HighLevelGpuProgram
[03:35:55] Creating resource group General
[03:35:55] Creating resource group Internal
[03:35:55] Creating resource group Bootstrap
[03:35:55] Creating resource group AutoDetect
[03:35:55] SceneManagerFactory for type 'DefaultSceneManager' registered
[03:35:55] Registering ScriptLoader for patterns *.program *.material 
[03:35:55] Registering ResourceManager for type Material
[03:35:55] Registering ResourceManager for type Mesh
[03:35:55] Registering ResourceManager for type Skeleton
[03:35:55] Registering ScriptLoader for patterns *.particle 
[03:35:55] Win32 Platform Manager Loaded.
[03:35:55] Registering ScriptLoader for patterns *.fontdef 
[03:35:55] Registering ResourceManager for type Font
[03:35:55] Registering ScriptLoader for patterns *.overlay 
[03:35:55] OverlayElementFactory for type 'BorderPanel' registered.
[03:35:55] OverlayElementFactory for type 'TextArea' registered.
[03:35:55] OverlayElementFactory for type 'Panel' registered.
[03:35:55] Registering ScriptLoader for patterns *.compositor 
[03:35:55] Registering ResourceManager for type Compositor
[03:35:55] Registering ScriptLoader for patterns *.os 
[03:35:55] Could not load file or assembly 'file:///c:\users\vitaly koshura\documents\visual     studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\devil.dll' or one of     its dependencies. The module was expected to contain an assembly manifest.
[03:35:55] Could not load file or assembly 'file:///c:\users\vitaly koshura\documents\visual     studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\freeimage.dll' or     one of its dependencies. The module was expected to contain an assembly manifest.
[03:35:55] Could not load file or assembly 'file:///c:\users\vitaly koshura\documents\visual     studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\freetype6.dll' or     one of its dependencies. The module was expected to contain an assembly manifest.
[03:35:55] Could not load file or assembly 'file:///c:\users\vitaly koshura\documents\visual     studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\ilu.dll' or one of     its dependencies. The module was expected to contain an assembly manifest.
[03:35:55] Could not load file or assembly 'file:///c:\users\vitaly koshura\documents\visual     studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\ilut.dll' or one of     its dependencies. The module was expected to contain an assembly manifest.
[03:35:55] Could not load file or assembly 'file:///c:\users\vitaly koshura\documents\visual     studio 2013\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\zlib1.dll' or one of     its dependencies. The module was expected to contain an assembly manifest.
[03:35:55] Could not load file or assembly 'Tao.DevIl, Version=1.6.8.3, Culture=neutral,     PublicKeyToken=7ec4053013524957' or one of its dependencies. The system cannot find the file     specified.
   at Axiom.Plugins.DevILCodecs.ILImageCodec.InitializeIL()
   at Axiom.Plugins.DevILCodecs.ILImageCodec..ctor()
   at Axiom.Plugins.DevILCodecs.BMPCodec..ctor()
   at Axiom.Plugins.DevILCodecs.Plugin.Initialize()
   at Axiom.Core.PluginManager.LoadPlugin(ObjectCreator creator)
[03:35:55] FreeImage Version: 3.14.1
[03:35:55] This program uses FreeImage, a free, open source image library supporting all common     bitmap formats. See http://freeimage.sourceforge.net for details
[03:35:55]  Supported formats:     bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,ti    ff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,drf,dsc,ptx,cap,iiq,rwz
[03:35:55] Loaded plugin: Axiom FreeImage Codecs Plugin
[03:35:55] Loaded plugin: Axiom System.Drawing Codecs Plugin
[03:35:55] [D3D] : Direct3D9 Rendering Subsystem created.
[03:35:55] Loaded plugin: Axiom DirectX9 Rendering Subsystem
[03:35:55] Factory EntityFactory registered for MovableObjectType 'Entity'.
[03:35:55] Factory LightFactory registered for MovableObjectType 'Light'.
[03:35:55] Factory BillboardSetFactory registered for MovableObjectType 'BillboardSet'.
[03:35:55] Factory ManualObjectFactory registered for MovableObjectType 'ManualObject'.
[03:35:55] Factory BillboardChainFactory registered for MovableObjectType 'BillboardChain'.
[03:35:55] Factory RibbonTrailFactory registered for MovableObjectType 'RibbonTrail'.
[03:35:55] Factory MovableTextFactory registered for MovableObjectType 'MovableText'.
[03:35:55] Added resource location 'Media' of type 'Folder' to resource group 'General'
[03:35:55] Initializing all resource groups:
[03:35:55] Initializing resource group AutoDetect.
[03:35:55] Parsing scripts for resource group AutoDetect
[03:35:55] Finished parsing scripts for resource group AutoDetect
[03:35:55]  AutoDetect initialized.
[03:35:55] Initializing resource group Bootstrap.
[03:35:55] Parsing scripts for resource group Bootstrap
[03:35:55] Finished parsing scripts for resource group Bootstrap
[03:35:55]  Bootstrap initialized.
[03:35:55] Initializing resource group General.
[03:35:55] Parsing scripts for resource group General
[03:35:55] Parsing script Penguin.material
[03:35:55] Finished parsing scripts for resource group General
[03:35:55]  General initialized.
[03:35:55] Initializing resource group Internal.
[03:35:55] Parsing scripts for resource group Internal
[03:35:55] Finished parsing scripts for resource group Internal
[03:35:55]  Internal initialized.
[03:35:55] CPU Identifier & Features
[03:35:55] -------------------------
[03:35:55] CPU Identification not available
[03:35:55]  *     SSE1: False
[03:35:55]  *     SSE2: False
[03:35:55]  *     SSE3: False
[03:35:55]  *    SSSE3: False
[03:35:55]  *    SSSE3: False
[03:35:55]  *    SSSE3: False
[03:35:55]  *    SSSE3: False
[03:35:55] -------------------------
[03:35:55] [D3D9] : Subsystem Initializing
[03:35:55] ***************************************
[03:35:55] *** D3D9 : Subsystem Initialized OK ***
[03:35:55] ***************************************
[03:35:55] D3D9RenderSystem::createRenderWindow "RenderWindow", 1002x522 windowed miscParams:     externalWindowHandle = 15076680; 
[03:35:55] D3D9 : Created D3D9 Rendering Window 'RenderWindow' : 1002x522, 0bpp
[03:35:55] D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at lower     frame rates, turn VSync on if you observe this problem.
[03:35:55] ---RenderSystem capabilities---
[03:35:55]  -GPU Vendor: Unknown
[03:35:55]  -Device Name: 
[03:35:55]  -Driver Version: 0.0.0.0
[03:35:55]  -Available texture units: 8
[03:35:55]  -Maximum lights available: 10
[03:35:55]  -Hardware generation of mip-maps: yes
[03:35:55]  -Texture blending: yes
[03:35:55]  -Anisotropic texture filtering: yes
[03:35:55]  -Dot product texture operation: yes
[03:35:55]  -Cube Mapping: yes
[03:35:55]  -Hardware stencil buffer: no
[03:35:55]  -Hardware vertex/index buffers: yes
[03:35:55]  -Vertex programs: yes
[03:35:55]      -Max vertex program version: vs_3_0
[03:35:55]  -Fragment programs: yes
[03:35:55]      -Max fragment program version: ps_3_0
[03:35:55]  -Texture compression: yes
[03:35:55]      -DXT: yes
[03:35:55]      -VTC: no
[03:35:55]  -Scissor rectangle: yes
[03:35:55]  -Hardware Occlusion Query: yes
[03:35:55]  -User clip planes: yes
[03:35:55]  -VertexElementType.UBYTE4: yes
[03:35:55]  -Infinite far plane projection: yes
[03:35:55]  -Max Point Size: 0 
[03:35:55]  -Vertex texture fetch: no 
[03:35:55] Particle Renderer type 'billboard' registered.
[03:35:55] Creating viewport rendering from camera 'MainCamera', relative dimensions     L:0,T:0,W:1,H:1, Z-Order:100
[03:35:55] Viewport for camera 'MainCamera' - actual dimensions L:0,T:0,W:1002,H:522, AR:1,91954
[03:35:55] Mesh: Loading 'penguin.mesh'...
[03:35:55] Skeleton: Loading 'penguin.skeleton'...
[03:35:55] Unable to load skeleton penguin.skeleton for Mesh penguin.mesh. This Mesh will not be animated. You can ignore this message if you are using an offline tool.
[03:35:55] WARNING: penguin.mesh is an older format ([MeshSerializer_v1.40]); you should upgrade     it as soon as possible using the OgreMeshUpdate tool.
[03:35:55] Texture: penguin.jpg: Loading 1 faces( PF_A8B8G8R8, 512x512x1 ) with hardware generated mipmaps from an Image.
     Internal format is PF_A8R8G8B8 , 512x512x1.
如何正确加载带有纹理的模型

谢谢