Keeping in the learning of DirectX trough SharpDX, it came the time for rendering something more complex. Since SharpDX has no implementation of a method to load meshes, I had to use Assimp.net.
The first obstacle for that, was that Assimp wrapper is for .net 4, and I was using Visual Studio 2008. Anyway, after switching to Visual “Studio 2010 (entirely against my will, since I don’t like changes), I tought that the process to render a mesh was going to be excruciatingly difficult, but still, I just pushed myself into the pool. Turns out that, after reading the Getting Started tutorial on Assimp .net site and using some logic, it was really simple to extract vertex info from the Assimp imported scene. Anyway, after placing all vertices on its place, the first render spat out this (with depth output shader):
Clearly something was wrong, and it was not the shader.
I suspected that the method to draw a bunch of triangles with textures was different to the one used to draw a simple colored cube, so I searched for “DX9 render mesh” and the first page I checked was talking about Indexed primitives. Okay, so let’s get the indexes from the Assimp scene structure and set those in the device. I also changed from DrawPrimitives to DrawIndexedPrimitive. The result, was exactly the same.
What was I doing wrong? The insanely small amount of DX tutorials (or my lack of ability to find them) was driving me to drop the entire thing. And I did, for a day. Yesterday, I checked all the code and I found a line I forgot to change when I was copying the code for the vertex declaration. I was using Vector3d for the vertices, but I was using float4 in the declaration. After changing that, and adding simple camera functionality, the magic:
Original from Assimp viewer (inverted because of my camera position):
So that’s it. I’m now ready to proceed to what I was interested since the beginning: Build a framework to try complex post processing shaders and implement stuff like Deferred rendering that is a little harder using C++ than using .net languages. But now I have a big question that I will ask around. Should I keep learning DX9 or skip it and go directly to DX10 and above?