bonosa's picture

GLControl.Refresh question

I'm on windows XP 64 bit using C# in visual studio 2008.New to c#, OpenTK.
I have some c# code that draws a jpeg onto a gL control. In stepping into the code i reach a point where I keep going round and round in the while (refreshing) while loop in the REfreshTHread function below, and as soon as i press the step out button, the jpeg gets rendered. IT is not clear to me what makes the pic get drawn because it's not obvious where the code execution goes when one steps out of the while loop:

relevant code

refreshThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(RefreshThread));
 
         refreshThread.Start();
      private void RefreshThread(object state)
      {
         while (!this.Created) { }
         while (refreshing)
         {
            try
            {
               this.Invoke((MethodInvoker)delegate
               {
                  glControl.Refresh();
               });
            }
            catch { }
 
            System.Threading.Thread.Sleep(50);
         }
      }

I hope this is sufficient info to answer my question.
thanks,
sb