public void ElementSizeChanged(double w, double h) { if (oglView != null) { // // 現在のOGLViewを削除 baseView.RemoveView(oglView); oglView.Dispose(); oglView = null; } oglView = new OGLView(this.Context) { Sphere = ((EquirectanglarView)Element).Sphere, VertexShader = ((EquirectanglarView)Element).VertexShader, FragmentShader = ((EquirectanglarView)Element).FragmentShader, TextureImage = ((EquirectanglarView)Element).TextureImage }; baseView.AddView(oglView, LayoutParams.MatchParent); }
public Form1() { Common.ViewModelSyncRoot.Init(); InitializeComponent(); AllowDrop = true; DragEnter += (o, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Link; } else { e.Effect = DragDropEffects.None; } }; DragDrop += OnDropFileAsync; GLView = new OGLView() { Location = new System.Drawing.Point(0, 0), Name = "oglv", Size = ClientSize, ResizeBGDraw = false }; Core = new RenderCore(); OperateTargets[0] = Core.TheScene.MainCamera; OperateTargets[1] = Core.TheScene.Drawables.LastOrDefault(); OperateTargets[2] = Core.TheScene.Lights.LastOrDefault(); Core.Resize((uint)ClientSize.Width, (uint)ClientSize.Height); Controls.Add(GLView); Resize += (o, e) => { GLView.Size = ClientSize; }; FormClosing += (o, e) => { Core.Dispose(); Core = null; }; GLView.Draw += Core.Draw; GLView.Resize += (o, e) => { Core.Resize((uint)e.Width, (uint)e.Height); }; GLView.KeyDown += OnKeyDown; //oglv.KeyAction += OnKeyAction; GLView.MouseAction += OnMouse; }
public void ElementSizeChanged(double w, double h) { if (oglView != null) { // // 現在のOGLViewを削除 oglView.RemoveFromSuperview(); oglView.Dispose(); oglView = null; } oglView = new OGLView(new CGRect(0, 0, w, h)) { Sphere = ((EquirectanglarView)Element).Sphere, VertexShader = ((EquirectanglarView)Element).VertexShader, FragmentShader = ((EquirectanglarView)Element).FragmentShader, TextureImage = ((EquirectanglarView)Element).TextureImage }; baseView.Add(oglView); // // iOSでは iPhoneOSGameView::OnLoadがコールされないので、ここで明示的にInitializeをコールする // oglView.Initialize(); }