public override void DrawInCGLContext(MonoMac.OpenGL.CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, CVTimeStamp timeStamp) { GL.ClearColor(NSColor.Clear.UsingColorSpace(NSColorSpace.CalibratedRGB)); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Enable(EnableCap.DepthTest); GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Nicest); if (previousTime == 0) { previousTime = timeInterval; } rotation += 15.0 * (timeInterval - previousTime); GL.LoadIdentity(); double comp = 1 / Math.Sqrt(3.0); GL.Rotate(rotation, comp, comp, comp); drawCube(); GL.Flush(); previousTime = timeInterval; GL.Disable(EnableCap.DepthTest); GL.Hint(HintTarget.LineSmoothHint, HintMode.DontCare); GL.Hint(HintTarget.PolygonSmoothHint, HintMode.DontCare); }
private void SetupDisplayLink() { if (displayLink != null) { return; } // Create a display link capable of being used with all active displays displayLink = new CVDisplayLink(); // Set the renderer output callback function displayLink.SetOutputCallback(MyDisplayLinkOutputCallback); // Set the display link for the current renderer CGLContext cglContext = openGLContext.CGLContext; CGLPixelFormat cglPixelFormat = PixelFormat.CGLPixelFormat; displayLink.SetCurrentDisplay(cglContext, cglPixelFormat); }
public override bool CanDrawInCGLContext (CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, ref CVTimeStamp timeStamp) { if (!animate) previousTime = 0.0; return animate; }
public CVReturn SetCurrentDisplay (CGLContext cglContext, CGLPixelFormat cglPixelFormat) { return CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext (this.handle, cglContext.Handle, cglPixelFormat.Handle); }