0

I am using SharpGL to use OpenGL in WPF. I know how to draw things in immediate mode, but I would like to animate each iteration of the drawing. I am drawing a line strip but my problem is that it displays it all at once, I would like to be able to show to object being drawn. I have tried using glFlush to force it to draw it line by line but it is not working. Any ideas, here is my code:

 gl.Begin(OpenGL.GL_LINE_STRIP);
                        for (int i = 0; i < parser.dataSet.Count; i++)
                        {

                           gl.Color((float)i, 3.0f, 0.0f);
                           gl.Vertex(parser.dataSet[i].X, parser.dataSet[i].Y, parser.dataSet[i].Z);
                           gl.Flush();
                        }
                       gl.End();
TheBlindSpring
  • 631
  • 5
  • 22

1 Answers1

0

You could try using a counter that gets incremented each frame. Start the counter off at 0 to draw nothing and let it go up to parser.dataSet.Count. Then change your loop to have i < counter instead of i < parser.dataSet.Count. You could use a timer to control how often you want to update the counter. Also I don't think you're supposed to call gl.Flush between gl.Begin and gl.End. There is a limited set of functions you can use between those two function calls.

user3256930
  • 1,123
  • 7
  • 12