   Trying to learn SlimDX but I cant get my simple triangle to draw
  I cannot figure out what I am doing wrong in this simple triangle I coded my self, not copy and paste, and it just will not draw anything. I followed the examples in the documentation and others I found online but I cant spot the problem in this. Hopefuly one of you can spot the problem?*edit updated code*namespace SlimDX_Test {    public partial class Form1: Form {   Device device = null;   PresentParameters presentParam = null;   VertexBuffer vertexBuffer = null;   bVertex[] verticies = new bVertex[]{  new bVertex(-20f,5f,20.0f,1f,new Color4(255,0,0)),  new bVertex(-20f,40f,20.0f,1f,new Color4(0,255,0)),  new bVertex(20f,40f,20.0f,1f,new Color4(0,0,255))   };   public Form1() {    InitializeComponent();  presentParam = new PresentParameters();  presentParam.BackBufferWidth = 620;  presentParam.BackBufferHeight = 480;  presentParam.DeviceWindowHandle = this.Handle;  presentParam.PresentationInterval = PresentInterval.Immediate;  presentParam.SwapEffect = SwapEffect.Discard;  presentParam.Windowed = true;  device = new Device(new Direct3D(),0,DeviceType.Hardware,this.Handle,CreateFlags.HardwareVertexProcessing,presentParam);  vertexBuffer = new VertexBuffer(device,bVertex.SizeInBytes * 3,Usage.WriteOnly,VertexFormat.PositionRhw | VertexFormat.Diffuse,Pool.Managed);   }   private void Form1_Load(object sender,EventArgs e) {  this.Size = new Size(620,480);  Application.Idle += new EventHandler(Application_Idle);  device.SetStreamSource(0,vertexBuffer,0,0);  device.VertexFormat = VertexFormat.PositionRhw | VertexFormat.Diffuse;  vertexBuffer.Lock(0,0,LockFlags.None).WriteRange<bVertex>(verticies);  vertexBuffer.Unlock();   }   private void Application_Idle(object sender,EventArgs e){  device.Clear(ClearFlags.Target,Color.White,1.0f,0);  device.BeginScene();  device.DrawPrimitives(PrimitiveType.TriangleStrip,0,1);  device.EndScene();  device.Present();   }   protected override void OnClosed(EventArgs e) {  device.Direct3D.Dispose();  device.Dispose();  vertexBuffer.Dispose();  base.OnClosed(e);   }    }}I am thankful for any help you guys can give me, I am sorta lost on this one.[Edited by - noey699 on May 13, 2010 8:00:19 PM]
  I see a few problems.1. Don't write your vertices to the vertex buffer in the main loop. You should only write them once, at the beginning when you create the vertex buffer.2. Application.Idle is only fired once when the application first goes idle. You have to loop inside the event handler for as long as it remains idle.3. You don't dispose of any of your resources when the program finishes. You should be able to see the list of objects still remaining in the Output window when the program exits.4. You're using pre-transformed vertices, but I suspect the positions you are providing are too big and too close to the camera.   ;  I fixed the iussues you specified, no objects remain in ouput, and I only write to vertex buffer once. Also Application_Idle is being called once per frame, I have already checked that. And I have tried multiple values vor my verticies, nothing ever shows up. I am still getting nothing on my screen, it just shows white. Please look over my code again, see if I am missing any calls to methods or have any wrong parameters. And sorry I didnt use source tags, i used code tags instead.   ;  1. Don't set the stride parameter of SetStreamSource to 0. Set it to the size of a vertex in your vertex buffer.2. Disable culling by setting the appropriate render state.3. Your vertices are pre-transformed, so you're essentially providing pixel values. Your negative vertices will be off the screen and not visible. Also, your Z-values need to be between 0 and 1.   ;  I made all the changes and I am still getting nothing to draw...   ;  Well I'm not much of a mind reader, so if you want more help you're going to have to post your updated code.   