's picture

Issue while running Multiple window - Few windows are hanging and not running smoothly.

Project:The Open Toolkit library
Version:all versions
Category:support request

I have a custom a custom contol as shown below

public class MultiStripChartGL : GLControl

I use this for plotting a graph on the form. The issue is that when I create multiple instance of this control in run time and drag and drop values to it to run those params ( that's how i designed to plot the graph), it works for 1 or 2 instances. The moment the number of instance increase to 4 to 5 only last 2 charts are running smoothly. Rest are actually hangs a lot...

I wrote the following things....
1) I wrote the following lines at the beginning and end of the OnPaint method and resize event

2) Added the below code in the load

this.Context.VSync = true;

These two improves the performance but still the first few windows out of all 5 windows are running so slowly or having hanging.. Please help. Its very urgent....


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


How are you updating the graphs? Are you waiting for normal Paint events or are you using a Invalidate or Idle game loop?

It is very difficult to guess what might be wrong without seeing some code (e.g. your Application.Idle loop, if you are using that).'s picture


Hello Fiddler, Thanks for your reply.... :)

OnLoad event I have the code as follows... Where i call the invalidate method.

_newThread = new System.

private void threadLoop()
while (_newThread .IsAlive)
double milliseconds = computeTimeSlice();

Coming back to the inputs, x axis we have a number (say between -100 to 100) and y axis is time. As i explained earlier, We drop this input parameter from a main window and it maintains a list of numbers (which grows dynamically - say 10 points per second or so and these values are plotted in x axis of the graph)

My OnPaint looks like this....

protected override void OnPaint(PaintEventArgs e)
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
//My code to get the values from parameter and plot it in the graph
//The code is in such a way that we draw only those points which comes in the display area.

Please let me know if I can provide you some more information to sort this out?