I am using the OpenTK and c#. I have developed a graphics application that works fine but is slow. I need help to improve the performance of the application. My application generates a model that is made up of several elements. This is what I do for each element :
1- test if element has a result.
2- open file and read the result of each element.
3- choice the color of the element switch of the value of the result.
4- draw the element.
I’m new in opentk, when i follow the execution of my program, i note that my program return to glcontrol1_paint many times ( and in my program i call once time).
i think that 's why my program is slow.
my function glControl1_Paint,
private void glControl1_Paint(object sender, PaintEventArgs e)
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.PushMatrix(); GL.Translate(x, 0, 0); GL.Translate(0, y, 0); GL.Translate(0, 0, z); GL.Translate(xp, yp, zp); GL.Rotate(rotationZ, Vector3.UnitZ); GL.Rotate(rotationY, Vector3.UnitY); GL.Rotate(rotationX, Vector3.UnitX); GL.Translate(-xp, -yp, -zp); GL.Scale(scale, scale, scale); Draw(); GL.PopMatrix(); glControl1.SwapBuffers(); }