protected override void OnOpenGlRender(GlInterface gl, int fb) { if (m_asset == null) { return; } if ((m_lastmotion == null) || (m_lastmotion.Finished == true)) { var motion_group = m_asset.MotionGroups[""]; int number = new Random().Next() % motion_group.Length; var motion = (CubismMotion)motion_group[number]; m_lastmotion = m_asset.StartMotion(MotionType.Base, motion, false); } m_asset.Update(m_time.ElapsedMilliseconds / 1000.0); m_time.Restart(); double controlScaling = VisualRoot.RenderScaling; int w = (int)(Bounds.Width * controlScaling); int h = (int)(Bounds.Height * controlScaling); double r = Math.Sqrt(((float)w) / h); gl.Viewport(0, 0, w, h); gl.Clear(GL_COLOR_BUFFER_BIT); Matrix4x4 mvp_matrix = Matrix4x4.Identity; if (h >= w) { mvp_matrix.M11 = 1.5f; mvp_matrix.M22 = -1.5f * w / h; } else { mvp_matrix.M11 = 1.5f * h / w; mvp_matrix.M22 = -1.5f; } m_rendermgr.Draw(mvp_matrix); Dispatcher.UIThread.Post(InvalidateVisual, DispatcherPriority.Background); }
protected override void OnOpenGlRender(GlInterface gl, int fb) { gl.ClearColor(0, 1, 0, 1); gl.Clear(GlConsts.GL_DEPTH_BUFFER_BIT | GlConsts.GL_COLOR_BUFFER_BIT); }