ajon542 / GameEngine

Experimenting with OpenTK inside WPF
0 stars 0 forks source link

Crash when creating SceneView #26

Open ajon542 opened 8 years ago

ajon542 commented 8 years ago

Reproduction Steps: Views -> Scene (to close the SceneView) Views -> Scene (to open the SceneView) Select SceneView tab

Crash occurs.

ajon542 commented 8 years ago

When you close the SceneView with the "X" it will run the Destroy method. All seems fine if you do this method.

ajon542 commented 8 years ago

It's crashing on GL.DrawElements(mesh.RenderType, mesh.Indices.Count, DrawElementsType.UnsignedInt, 0);

ajon542 commented 8 years ago

In the SceneViewModel.Initialize method there is a boolean "isLoaded" which is set to true. A new GLControl is created in OnHostInitialized which would mean we should probably be initializing the scene again.

ajon542 commented 8 years ago

The Initialization procedure is a little confusing. Each scene is constructed quite early, prior to the GL context being created. I think the construction should be moved to where the initialization occurs.