terryhau's picture

GLControl creating OpenGL context during design time

Using 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

Comment viewing options

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

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.

the Fiddler's picture

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.

terryhau's picture

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-...

terryhau's picture

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