nlraley's picture

Problem with OpenTK and DevExpress Document and Dock Managers

I am trying to provide support for dockable panels and content for my application that was running OpenTK using your GLControl.

The first render is rendering everything fine. I pre-load all of my textures before displaying anything and the entire scene, background and all is rendered just fine. However, when the panel that contains the GLControl has its docked parent changed, none of the pre-loaded textures are able to be drawn for the background. The primitives are rendered just fine, OpenGL just does not load any of my textures at that point. Changing the docked parent back to the original does not work as well.

I was wandering if someone would have any ideas as to what may be going on that would cause the primitives to render fine but the textures to not render?


Comment viewing options

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

It might be the case that the GLControl handle is destroyed and recreated when the docked parent is changed. In this case, the GLControl has no other choice but to recreate its GraphicsContext, deleting your textures in the process.

You can verify whether this happens by hooking the HandleDestroyed event. If this is indeed the case, you should be able to fix the issue by detaching the GLControl from the Panel temporarily when changing its docked parent.

nlraley's picture

Thanks, that worked.

For anyone needing to know how to do this, on the form which hosts your control you simply need to perform the following:

protected override void OnHandleCreated(EventArgs e)
            if (glControl1 != null)
        protected override void OnHandleDestroyed(EventArgs e)
            if (!first && glControl1 != null)
            first = false;

Where glControl1 is the name of your OpenGL GLControl.