Forums - C# Corner

Forum guidelines

Simple Dot Rendering

Mar 5 2005 3:25 PM
First I want to say I'm very new to directx. I'm trying to build a simple game. I already have a loop and sort of GameTimer. With this I was able to render a "color-fading" background. But offcourse I want more ;-). I'm trying to render a group of dots. this is my dot-array: public CustomVertex.TransformedColored[] DotData; And I'm trying to fill it this way: for(int i = 0; i < 100; i++) { DotData[0].X = rand.Next(100); DotData[i].Y = rand.Next(100); DotData[i].Z = 1.0f; DotData[i].Rhw = 1.0f; DotData[i].Color = Color.FromArgb(rand.Next(200) + 55, rand.Next(200) + 55, rand.Next(200) + 55).ToArgb(); } Compiling goes well, but when i launch the application I get this error (translated from dutch to english): The appication generated an exeption wich cannot be processed. Process-id=0xb48 (2888), thread-id=0xf04 (3844) Click OK to close the application. Click CANCEL to track errors in the application. When I click cancel it says the error-tracker isn't available. And when I click OK the application exits. This code produces the same error: DotData[0].X = 10; And when I comment that line all works well (no dots offcourse, but I do see the fading BG). Does anyone know what is wrong? Thanks in advance, Jules

Download Free eBooks


File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!