   [SlimDX] What is my draw operation missing?
  Everything runs fine; however, there is a distinct lack of a cube onscreen.   public override void Draw(double dt)   {  Matrix view = Matrix.LookAt( Vector3.Transform(Vector3.Zero, Matrix.Translation(Vector3.Zero)), Vector3.Transform(Vector3.Zero, Matrix.Translation(Vector3.Forward)), Vector3.Transform(Vector3.Up, RotationMatrix.Identity).Normalized  );  Matrix projection = Conversions.FromDirectXMatrix(SlimDX.Matrix.PerspectiveFovLH((float)(Math.PI * 0.25), 800.0F / 600.0F, 1.0F, 10000.0F));  GlobalData.DeviceManager.SetTransform(TransformState.Projection, projection);  GlobalData.DeviceManager.SetTransform(TransformState.View, view);  Matrix world = Matrix.Scale(1.0) * this.WorldRotation * Matrix.Translation(this.WorldPosition);  GlobalData.DeviceManager.SetTransform(TransformState.World, world);  int i, count = this.mesh.GetMaterials().Count();  for (i = 0; i < count; ++i)  { this.mesh.DrawSubset(i);  }  base.Draw(dt);   }
  Depends where the cube is.  It could be behind you (at least in my experience that's the most common reason for lack-of-cube).;  Provided my LookAt function has not gotten itself borked - That's one of the first things I checked....Yeah, maybe I should post them...   public static Matrix LookAt(Vector3 position, Vector3 pointTo, Vector3 upVector)   {  Vector3 zAxis = Vector3.Normalize(pointTo - position);  Vector3 xAxis = Vector3.Normalize(Vector3.Cross(upVector, zAxis));  Vector3 yAxis = Vector3.Cross(zAxis, xAxis);  return new Matrix(xAxis.X, yAxis.X, zAxis.X, 0,xAxis.Y, yAxis.Y, zAxis.Y, 0,xAxis.Z, yAxis.Z, zAxis.Z, 0,-Vector3.Dot(xAxis, position), -Vector3.Dot(yAxis, position), -Vector3.Dot(zAxis, position), 1  );   }   public static Vector3 Cross(Vector3 a, Vector3 b)   {  Vector3 r;  r.X = a.Y * b.Z - a.Z * b.Y;  r.Y = a.Z * b.X - a.X * b.Z;  r.Z = a.X * b.Y - a.Y * b.X;  return r;   }   public static double Dot(Vector3 a, Vector3 b)   {  return ((a.X * b.X) + (a.Y * b.Y) + (a.Z * b.Z));   };  Looks ok to me...   Is the cube outside of the frustum?   ;  The cube is at V3(0, 0, -20), or Vector3.Forward * 20. It's not too small, unless it's somehow drawn tiny enough that a 100x scaling factor won't make it visible...I should test to see if it's too large...Same for reduced scaling.Also, I'm using the DirectX9 version of SlimDX.   ;  Alright, nobody's pointed out any bugs in there...So, time to check other parts of the code:Edit: DeviceManager is just a wrapper for the SlimDX.Direct3D9.Device class.My main loop in my abstract Game class.   public virtual bool Run()   {  do  { double dt = NetExtensions.GeneralData.Stopwatch.Elapsed.TotalSeconds - lastTime; this.lastTime = NetExtensions.GeneralData.Stopwatch.Elapsed.TotalSeconds; if (displayOwner.ContainsFocus) {this.Update(dt);displayOwner.Update();GlobalData.DeviceManager.BeginScene();this.Draw(dt);GlobalData.DeviceManager.EndScene();GlobalData.DeviceManager.Present();// Max of 60 FPSwhile ((NetExtensions.GeneralData.Stopwatch.Elapsed.TotalSeconds - lastTime) < (1.0 / 60.0))    ; } Application.DoEvents(); // Self-explanatory variable.  } while (!this.isDead);  return true;   }And, some relevant code, such as content creation, updating and drawing:   SceneNodeTranslation node1;   protected override void LoadContent()   {  node1 = new SceneNodeTranslation(Vector3.Forward * 20);  node1.AddChild("Cube", GlobalData.Content.Load<SceneNodeModel>("Cube.x"));   }   public override void Update(double timeStep)   {  // Everything updates. Not that there's any update code to run,  // Except for the code that calls Update on the SceneNode's children.  node1.Update(timeStep);   }   public override void Draw(double timeStep)   {  // It's not my favorite color.  GlobalData.DeviceManager.Clear(Color.Blue);  // This does call the SceneNodeModel's Draw function.  node1.Draw(timeStep);   };  Second-page bump.   ;  Fixed it - Turns out, the integer values in SlimDX.Direct3D9.Device.SetTransform(int state) are not equivalent to the integer values stored in the TransformState enum.So, I have to do a "(SlimDX.Direct3D9.TransformState)myState" conversion, instead of "(int)myState". Doesn't make too much sense, but there you go.   ;  What do you mean by the TransformaEnum doesn't match the ints? What is wrong?Thanks!   ;  Simple. I set my TransformState Enum using the same values as SlimDX's TransformState Enum (Literally - I did a direct value assignment for each). If I use "SetTransform((int)MyTransformState, Matrix);", it doesn't work. If I use "SetTransform((SlimDXTransformState)MyTransformState, Matrix);", it works.   