Seemingly Random Memory Error

May 3, 2012 at 10:52 PM



I'm still working from a very modified version of example 5. I think that I am not cleaning everything up properly but I'm not sure how to achieve this.

Here is the method I am using to draw my shapes:

int DrawGLScene(float[, ,] xyAxis, int rowCount)                                 // Here's Where We Do All The Drawing

            if (sceneControl1.Scene.Quadrics.Count > 0)

            int xMax = xyAxis.GetUpperBound(0);
            globalXYaxis = xyAxis;
            for (xloop = 0; xloop <= xMax; xloop++)                            // Loop Through The Y Plane
                SharpGL.SceneGraph.Quadrics.Sphere sphere1 = new SharpGL.SceneGraph.Quadrics.Sphere();
                sphere1.Radius = 0.1f;
                sphere1.Translate.X = xyAxis[xloop, 1, 0];
                sphere1.Translate.Y = xyAxis[xloop, 0, 0];
                sphere1.Translate.Z = xyAxis[0, 0, xloop]; // zAxis to go here...

                if (xyAxis[0, 0, xloop] > 0.40)
                    sphere1.Material.Ambient = Color.FromArgb(128, Color.AliceBlue);
                    sphere1.Material.Emission = Color.FromArgb(255, Color.LightGreen);
                    sphere1.Material.Shininess = 128.0f;
                    sphere1.Material.Specular = Color.FromArgb(0, Color.Black);

                    sphere1.Material.Ambient = Color.FromArgb(255, Color.AntiqueWhite);
                    sphere1.Material.Emission = Color.FromArgb(255, Color.AntiqueWhite);



            return 1;                                    // Jump Back

My program will error out at a random time and give a glError...but i'm having a hard time tracking down the solution. is there anything immediately obvious here to any one?



May 4, 2012 at 10:35 PM

I'm pretty sure this error has something to do with the Scene.Jam() function. What is the proper way to clear out the memory after I leave this? How should I go about clearing everything out?


May 7, 2012 at 10:08 PM

I updated to sharpGL 2.0 latest edition because the rev on the home page doesn't compile the samples. I'm working with SceneSample. The goal is to draw many of these cubes on the scene, not just one...wish me luck...