public override void SetupTooltip(PointF point, GH_TooltipDisplayEventArgs e) { // Allow the base class to set up the tooltip. // It will handle those cases where the mouse is over a state icon. base.SetupTooltip(point, e); try { using (var colorBuffer = PerFrameCache.GetTextureImage(_component, true)) using (var depthBuffer = PerFrameCache.GetTextureImage(_component, false)) { if (colorBuffer != null && depthBuffer != null) { var size = colorBuffer.Size; size.Width /= 2; var bmp = new System.Drawing.Bitmap(size.Width, size.Height); using (var g = System.Drawing.Graphics.FromImage(bmp)) { g.DrawImage(colorBuffer, Rectangle.FromLTRB(0, 0, size.Width, size.Height / 2)); g.DrawImage(depthBuffer, Rectangle.FromLTRB(0, size.Height / 2, size.Width, size.Height)); } e.Description = "Output Color/Depth Buffers"; e.Diagram = bmp; //e.Diagram = GH_IconTable.ResizeImage(colorBuffer, new Size(300, 200), //System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic, //System.Drawing.Imaging.PixelFormat.Format24bppRgb); } } } catch { /* no action required. */ } }
static void PostDrawObjects(object sender, DrawEventArgs args) { if (_activeShaderComponents.Count < 1) { return; } if (!OpenGL.Initialized) { OpenGL.Initialize(); } if (!OpenGL.IsAvailable) { return; } UpdateContext(args); SortComponents(); using (IDisposable lifetimeObject = PerFrameCache.BeginFrame(args.Display, _activeShaderComponents)) { foreach (var component in _activeShaderComponents) { if (component.Hidden) { continue; } if (!GLSLEditorDialog.EditorsOpen && !AnimationTimerEnabled) { string dataType; int arrayLength; if (component._model.TryGetUniformType("_time", out dataType, out arrayLength) || component._model.TryGetUniformType("_date", out dataType, out arrayLength) || component._model.TryGetUniformType("_mousePosition", out dataType, out arrayLength) || component._model.TryGetUniformType("_mouseDownPosition", out dataType, out arrayLength) || component._model.TryGetUniformType("_mouseState", out dataType, out arrayLength)) { AnimationTimerEnabled = true; } } component._model.Draw(args.Display, component); } } GLRecycleBin.Recycle(); _activeShaderComponents.Clear(); }
public void Dispose() { PerFrameCache.EndFrame(); }