oyvindra's picture

GLControl does not redraw in Visual Studio [resolved]

I am using Visual Studio 2005 and 2008 Express with OpenTK 0.9.1, GLControl does not redraw when editing, which can make the form look more than a little confusing when switching between the code and form view.

I don't know if this has been fixed in some later release,.


Comment viewing options

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

this is because OpenTK doesn't create a rendering context in design mode.

Suggestion: Simply draw the box with a grey background with GDI when in design mode.

the Fiddler's picture

This was a regression that resurfaced at some point between 0.9.0 and 0.9.1. Check the current SVN for a fix (the background is redrawn using the control's BackColor).

It is true that OpenTK does not create a real OpenGL context when in design mode (there is something called DummyGLContext to get around issues like this). Earlier versions actually did try to create an OpenGL context, only to cause VS to go up in flames - at some point, I saw VS allocate 1.2GB of memory before crashing with an "internal error". It might be possible to get OpenGL-in-design-mode to work, but I don't really think it's worth the effort.

If someone wishes to have some fun, just comment out the if (DesignMode) line in GLControl.cs:91. :D