protected override void OnRealized() { // Base implementation base.OnRealized(); // Make the context current MakeCurrent(); // Load OpenGL functions GL.LoadOpenGL(); // Set the size of the viewport ResizeViewport(); // Create the scene _editorScene = new SceneEditorScene(); // Initialize events _editorScene.GameElementAdded += _editorSceneGameElementAdded; _editorScene.GameElementRemoved += _editorSceneGameElementRemoved; // Create the game and add the scene _editorGame = new SceneEditorGame(_editorScene); // Enable depth testing RendererManager.DepthTest(); // Enable blending RendererManager.Blending(); // Enable face culling RendererManager.FaceCulling(); // Enable Multi Samples RendererManager.MultiSample(); // Enable depth mask RendererManager.DepthMask(); // Start the editor game _editorGame.Start(); // Initialize the renderer manager RendererManager.Initialize(); // Focus on the editor GrabFocus(); // Start updating the scene Gdk.Threads.AddIdle(120, OnUpdateFrameClock); // Refresh the game elements tree ((MainWindow)Toplevel).RefreshGameElementsTree(); }