示例#1
0
        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);
        }
示例#2
0
 public override void DrawInCGLContext (MonoMac.OpenGL.CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, ref 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);
         
         
 }
示例#3
0
				public override bool CanDrawInCGLContext (CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, ref CVTimeStamp timeStamp)
                {
                        if (!animate)
                                previousTime = 0.0;
                        return animate;
                }
示例#4
0
                public override CGLPixelFormat CopyCGLPixelFormatForDisplayMask (uint mask)
                {
                        // make sure to add a null value
                        var attribs = new object [] { 
							CGLPixelFormatAttribute.Accelerated, 
							CGLPixelFormatAttribute.DoubleBuffer, 
							CGLPixelFormatAttribute.ColorSize, 24, 
							CGLPixelFormatAttribute.DepthSize, 16 };
                        
                        CGLPixelFormat pixelFormat = new CGLPixelFormat (attribs);
                        return pixelFormat;
                }
	public CVReturn SetCurrentDisplay (CGLContext cglContext, CGLPixelFormat cglPixelFormat)
	{
		return CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext (this.handle, cglContext.Handle, cglPixelFormat.Handle);
	}     
示例#6
0
                public override CGLPixelFormat CopyCGLPixelFormatForDisplayMask (uint mask)
                {
                        
                        // make sure to add a null value
                        CGLPixelFormatAttribute[] attribs = new CGLPixelFormatAttribute[] { 
							CGLPixelFormatAttribute.Accelerated, 
							CGLPixelFormatAttribute.DoubleBuffer, CGLPixelFormatAttribute.ColorSize, (CGLPixelFormatAttribute)24, CGLPixelFormatAttribute.DepthSize, (CGLPixelFormatAttribute)16 };
                        
                        int numPixs = -1;
                        CGLPixelFormat pixelFormat = new CGLPixelFormat (attribs, out numPixs);
                        return pixelFormat;
                }