
GLControl creating OpenGL context during design time
Posted Tuesday, 24 May, 2011 - 12:10 by terryhau inUsing the latest 2010-10-06 release.
When you place a GLControl directly on to a form, it works fine.
However if you put a GLControl on to a user control and put that user control on to the form,
the GLControl creates a rendering context during design time and often it fails, causing crashes or errors.


Comments
Re: GLControl creating OpenGL context during design time
I think I've figured out why this is happening.
When editing a control MyControl in the designer, MyControl is obviously in "design mode".
When using MyControl on a form being edited in the designer, MyControl is still in "design mode".
But if MyControl is placed on MyOtherControl, and MyOtherControl is placed on a form, MyControl is no longer in design mode (but MyOtherControl still is)
Anyone know a way around this?
Thanks.
Re: GLControl creating OpenGL context during design time
Can you please create a simple test case and attach it to a bug report? I do not know whether this is an issue in OpenTK.GLControl or the WinForms designer.
Re: GLControl creating OpenGL context during design time
It appears this is a problem with the WinForms designer.
http://support.microsoft.com/kb/839202
I'm not sure if its a bug or by design.
From what I've read, the way around it is to use if(LicenseManager.UsageMode == LicenseUsageMode.Designtime) instead of if(DesignMode)
but this test only works in the control's constructor.
http://dotnetfacts.blogspot.com/2009/01/identifying-run-time-and-design-...
Re: GLControl creating OpenGL context during design time
I've created a test case and bug report, But I'm not sure how to attach the test case.
http://www.opentk.com/node/2506