2

I am creating an usercontrol contains a "Tao.Platform.Windows.SimpleOpenGlControl".
In my control's constructor, I have

{
    InitializeComponent();
    simpleOpenGlControl1.InitializeContexts();
}

My problem:
When I use the control on a "Windows Forms Application" it's ok, but if I put the computer at hibernate or sleep mode, when visual studio is open and form that contains the control, is in design mode, the next time I turn it on this error comes up:

Fatal Error
can not activate the gl rendering context

and visual studio is not responding!
What's wrong here? I am doing something wrong?

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16
mrbm
  • 1,136
  • 1
  • 12
  • 36
  • Old questions are not removed! Found your duplicate and flagged it. But 1+ for the afford to post the answer after a few month. – Felix K. Oct 11 '12 at 14:54

2 Answers2

1

I am using Tao framework. After implementing OpenGL chart solution, I encounter those error. Every time I tried to close form, error occurred. After few times of debugging, I found the reason. The reason is like this. On my form closing, Draw function tried to use OpenGlControl object ONE MORE TIME. So I make condition to check the additional flag.

Draken
  • 3,134
  • 13
  • 34
  • 54
exwaiz
  • 11
  • 2
0

I solved my problem in this way:
In control's InitializeComponent(); I removed simpleOpenGlControl1 Initialization and then in control's Load() function, I have

isDesignMode = LicenseManager.UsageMode == LicenseUsageMode.Designtime;
if (!isDesignMode)
{
    // init simpleOpenGlControl1
}

Now when my control is used in a project, there is no simpleOpenGlControl1 in design mode to make problem!

mrbm
  • 1,136
  • 1
  • 12
  • 36